summaryrefslogtreecommitdiff
path: root/test/Transforms
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-09-09 18:11:14 +0000
committerDan Gohman <gohman@apple.com>2008-09-09 18:11:14 +0000
commit488fbfc69e02c529ba7eeeb633a4e499fd6523c4 (patch)
tree06ab3048c18fbea22ca1106d6f943f5607139c6b /test/Transforms
parent0938f7424261cb99abaac4e5325487886e213dfb (diff)
downloadllvm-488fbfc69e02c529ba7eeeb633a4e499fd6523c4.tar.gz
llvm-488fbfc69e02c529ba7eeeb633a4e499fd6523c4.tar.bz2
llvm-488fbfc69e02c529ba7eeeb633a4e499fd6523c4.tar.xz
Make SimplifyDemandedVectorElts simplify vectors with multiple
users, and teach it about shufflevector instructions. Also, fix a subtle bug in SimplifyDemandedVectorElts' insertelement code. This is a patch that was originally written by Eli Friedman, with some fixes and cleanup by me. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55995 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/InstCombine/pr2645.ll33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/pr2645.ll b/test/Transforms/InstCombine/pr2645.ll
new file mode 100644
index 0000000000..04cc1852cb
--- /dev/null
+++ b/test/Transforms/InstCombine/pr2645.ll
@@ -0,0 +1,33 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {insertelement <4 x float> undef}
+
+; Instcombine should be able to prove that none of the
+; insertelement's first operand's elements are needed.
+
+define internal void @""(i8*) {
+; <label>:1
+ bitcast i8* %0 to i32* ; <i32*>:2 [#uses=1]
+ load i32* %2, align 1 ; <i32>:3 [#uses=1]
+ getelementptr i8* %0, i32 4 ; <i8*>:4 [#uses=1]
+ bitcast i8* %4 to i32* ; <i32*>:5 [#uses=1]
+ load i32* %5, align 1 ; <i32>:6 [#uses=1]
+ br label %7
+
+; <label>:7 ; preds = %9, %1
+ %.01 = phi <4 x float> [ undef, %1 ], [ %12, %9 ] ; <<4 x float>> [#uses=1]
+ %.0 = phi i32 [ %3, %1 ], [ %15, %9 ] ; <i32> [#uses=3]
+ icmp slt i32 %.0, %6 ; <i1>:8 [#uses=1]
+ br i1 %8, label %9, label %16
+
+; <label>:9 ; preds = %7
+ sitofp i32 %.0 to float ; <float>:10 [#uses=1]
+ insertelement <4 x float> %.01, float %10, i32 0 ; <<4 x float>>:11 [#uses=1]
+ shufflevector <4 x float> %11, <4 x float> undef, <4 x i32> zeroinitializer ; <<4 x float>>:12 [#uses=2]
+ getelementptr i8* %0, i32 48 ; <i8*>:13 [#uses=1]
+ bitcast i8* %13 to <4 x float>* ; <<4 x float>*>:14 [#uses=1]
+ store <4 x float> %12, <4 x float>* %14, align 16
+ add i32 %.0, 2 ; <i32>:15 [#uses=1]
+ br label %7
+
+; <label>:16 ; preds = %7
+ ret void
+}