summaryrefslogtreecommitdiff
path: root/test/Transforms/ArgumentPromotion/aggregate-promote.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/Transforms/ArgumentPromotion/aggregate-promote.ll')
-rw-r--r--test/Transforms/ArgumentPromotion/aggregate-promote.ll43
1 files changed, 25 insertions, 18 deletions
diff --git a/test/Transforms/ArgumentPromotion/aggregate-promote.ll b/test/Transforms/ArgumentPromotion/aggregate-promote.ll
index 3f521bace7f3..b0bab7784edb 100644
--- a/test/Transforms/ArgumentPromotion/aggregate-promote.ll
+++ b/test/Transforms/ArgumentPromotion/aggregate-promote.ll
@@ -1,24 +1,31 @@
-; RUN: opt < %s -argpromotion -instcombine -S | not grep load
-target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
+; RUN: opt < %s -argpromotion -S | FileCheck %s
+; RUN: opt < %s -passes=argpromotion -S | FileCheck %s
-%QuadTy = type { i32, i32, i32, i32 }
-@G = constant %QuadTy {
- i32 0,
- i32 0,
- i32 17,
- i32 25 } ; <%QuadTy*> [#uses=1]
+%T = type { i32, i32, i32, i32 }
+@G = constant %T { i32 0, i32 0, i32 17, i32 25 }
-define internal i32 @test(%QuadTy* %P) {
- %A = getelementptr %QuadTy, %QuadTy* %P, i64 0, i32 3 ; <i32*> [#uses=1]
- %B = getelementptr %QuadTy, %QuadTy* %P, i64 0, i32 2 ; <i32*> [#uses=1]
- %a = load i32, i32* %A ; <i32> [#uses=1]
- %b = load i32, i32* %B ; <i32> [#uses=1]
- %V = add i32 %a, %b ; <i32> [#uses=1]
- ret i32 %V
+define internal i32 @test(%T* %p) {
+; CHECK-LABEL: define internal i32 @test(
+; CHECK: i32 %{{.*}}, i32 %{{.*}})
+entry:
+ %a.gep = getelementptr %T, %T* %p, i64 0, i32 3
+ %b.gep = getelementptr %T, %T* %p, i64 0, i32 2
+ %a = load i32, i32* %a.gep
+ %b = load i32, i32* %b.gep
+; CHECK-NOT: load
+ %v = add i32 %a, %b
+ ret i32 %v
+; CHECK: ret i32
}
define i32 @caller() {
- %V = call i32 @test( %QuadTy* @G ) ; <i32> [#uses=1]
- ret i32 %V
+; CHECK-LABEL: define i32 @caller(
+entry:
+ %v = call i32 @test(%T* @G)
+; CHECK: %[[B_GEP:.*]] = getelementptr %T, %T* @G, i64 0, i32 2
+; CHECK: %[[B:.*]] = load i32, i32* %[[B_GEP]]
+; CHECK: %[[A_GEP:.*]] = getelementptr %T, %T* @G, i64 0, i32 3
+; CHECK: %[[A:.*]] = load i32, i32* %[[A_GEP]]
+; CHECK: call i32 @test(i32 %[[B]], i32 %[[A]])
+ ret i32 %v
}
-