summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2012-06-14 16:38:13 +0000
committerPete Cooper <peter_cooper@apple.com>2012-06-14 16:38:13 +0000
commita7e6d58a87360aa18a990bbfec98a444ce885ee0 (patch)
treea92a4ad676d57d62a330ebf5f215c45c468fb54a /llvm/test/Transforms
parentbe3d3a66eef6a7480ff315f0011377cc050c5b61 (diff)
downloadbcm5719-llvm-a7e6d58a87360aa18a990bbfec98a444ce885ee0.tar.gz
bcm5719-llvm-a7e6d58a87360aa18a990bbfec98a444ce885ee0.zip
Recommit r158407: Allow SROA to look at a vector type and see if the offset is out of range to be replaced with a scalar access. Now with additional fix and test for indexing into a vector inside a struct
llvm-svn: 158454
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/ScalarRepl/2011-06-08-VectorExtractValue.ll25
1 files changed, 18 insertions, 7 deletions
diff --git a/llvm/test/Transforms/ScalarRepl/2011-06-08-VectorExtractValue.ll b/llvm/test/Transforms/ScalarRepl/2011-06-08-VectorExtractValue.ll
index 98fa1c684ce..459688547fb 100644
--- a/llvm/test/Transforms/ScalarRepl/2011-06-08-VectorExtractValue.ll
+++ b/llvm/test/Transforms/ScalarRepl/2011-06-08-VectorExtractValue.ll
@@ -10,8 +10,7 @@ target triple = "x86_64-apple-macosx10.7.0"
; CHECK: main
; CHECK-NOT: alloca
-; CHECK: %[[A:[a-z0-9]*]] = and i128
-; CHECK: %[[B:[a-z0-9]*]] = trunc i128 %[[A]] to i32
+; CHECK: extractelement <2 x float> zeroinitializer, i32 0
define void @main() uwtable ssp {
entry:
@@ -28,8 +27,7 @@ entry:
; CHECK: test1
; CHECK-NOT: alloca
-; CHECK: %[[A:[a-z0-9]*]] = and i128
-; CHECK: %[[B:[a-z0-9]*]] = trunc i128 %[[A]] to i32
+; CHECK: extractelement <2 x float> zeroinitializer, i32 0
define void @test1() uwtable ssp {
entry:
@@ -43,9 +41,8 @@ entry:
; CHECK: test2
; CHECK-NOT: alloca
-; CHECK: and i128
-; CHECK: or i128
-; CHECK: trunc i128
+; CHECK: %[[A:[a-z0-9]*]] = extractelement <2 x float> zeroinitializer, i32 0
+; CHECK: fadd float %[[A]], 1.000000e+00
; CHECK-NOT: insertelement
; CHECK-NOT: extractelement
@@ -62,3 +59,17 @@ entry:
%r = fadd float %r1, %r2
ret float %r
}
+
+; CHECK: test3
+; CHECK: %[[A:[a-z0-9]*]] = extractelement <2 x float> <float 2.000000e+00, float 3.000000e+00>, i32 1
+; CHECK: ret float %[[A]]
+
+define float @test3() {
+entry:
+ %ai = alloca { <2 x float>, <2 x float> }, align 8
+ store { <2 x float>, <2 x float> } {<2 x float> <float 0.0, float 1.0>, <2 x float> <float 2.0, float 3.0>}, { <2 x float>, <2 x float> }* %ai, align 8
+ %tmpcast = bitcast { <2 x float>, <2 x float> }* %ai to [4 x float]*
+ %arrayidx = getelementptr inbounds [4 x float]* %tmpcast, i64 0, i64 3
+ %f = load float* %arrayidx, align 4
+ ret float %f
+}
OpenPOWER on IntegriCloud