aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/ArgumentPromotion
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-05-27 18:44:32 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-05-27 18:44:32 +0000
commit5a5ac124e1efaf208671f01c46edb15f29ed2a0b (patch)
treea6140557876943cdd800ee997c9317283394b22c /test/Transforms/ArgumentPromotion
parentf03b5bed27d0d2eafd68562ce14f8b5e3f1f0801 (diff)
Notes
Diffstat (limited to 'test/Transforms/ArgumentPromotion')
-rw-r--r--test/Transforms/ArgumentPromotion/2008-02-01-ReturnAttrs.ll2
-rw-r--r--test/Transforms/ArgumentPromotion/2008-07-02-array-indexing.ll6
-rw-r--r--test/Transforms/ArgumentPromotion/aggregate-promote.ll8
-rw-r--r--test/Transforms/ArgumentPromotion/attrs.ll8
-rw-r--r--test/Transforms/ArgumentPromotion/basictest.ll4
-rw-r--r--test/Transforms/ArgumentPromotion/byval-2.ll8
-rw-r--r--test/Transforms/ArgumentPromotion/byval.ll8
-rw-r--r--test/Transforms/ArgumentPromotion/chained.ll4
-rw-r--r--test/Transforms/ArgumentPromotion/control-flow.ll2
-rw-r--r--test/Transforms/ArgumentPromotion/control-flow2.ll7
-rw-r--r--test/Transforms/ArgumentPromotion/crash.ll8
-rw-r--r--test/Transforms/ArgumentPromotion/dbg.ll15
-rw-r--r--test/Transforms/ArgumentPromotion/fp80.ll12
-rw-r--r--test/Transforms/ArgumentPromotion/inalloca.ll12
-rw-r--r--test/Transforms/ArgumentPromotion/reserve-tbaa.ll12
-rw-r--r--test/Transforms/ArgumentPromotion/variadic.ll2
16 files changed, 60 insertions, 58 deletions
diff --git a/test/Transforms/ArgumentPromotion/2008-02-01-ReturnAttrs.ll b/test/Transforms/ArgumentPromotion/2008-02-01-ReturnAttrs.ll
index 1226b98a998e..c988774da8a7 100644
--- a/test/Transforms/ArgumentPromotion/2008-02-01-ReturnAttrs.ll
+++ b/test/Transforms/ArgumentPromotion/2008-02-01-ReturnAttrs.ll
@@ -3,7 +3,7 @@
; CHECK: define internal i32 @deref(i32 %x.val) #0 {
define internal i32 @deref(i32* %x) nounwind {
entry:
- %tmp2 = load i32* %x, align 4
+ %tmp2 = load i32, i32* %x, align 4
ret i32 %tmp2
}
diff --git a/test/Transforms/ArgumentPromotion/2008-07-02-array-indexing.ll b/test/Transforms/ArgumentPromotion/2008-07-02-array-indexing.ll
index 210eb97bc1dc..267a6c045974 100644
--- a/test/Transforms/ArgumentPromotion/2008-07-02-array-indexing.ll
+++ b/test/Transforms/ArgumentPromotion/2008-07-02-array-indexing.ll
@@ -7,14 +7,14 @@
define internal i32 @callee(i1 %C, i32* %A) {
entry:
; Unconditonally load the element at %A
- %A.0 = load i32* %A
+ %A.0 = load i32, i32* %A
br i1 %C, label %T, label %F
T:
ret i32 %A.0
F:
; Load the element at offset two from %A. This should not be promoted!
- %A.2 = getelementptr i32* %A, i32 2
- %R = load i32* %A.2
+ %A.2 = getelementptr i32, i32* %A, i32 2
+ %R = load i32, i32* %A.2
ret i32 %R
}
diff --git a/test/Transforms/ArgumentPromotion/aggregate-promote.ll b/test/Transforms/ArgumentPromotion/aggregate-promote.ll
index 12de51172739..3f521bace7f3 100644
--- a/test/Transforms/ArgumentPromotion/aggregate-promote.ll
+++ b/test/Transforms/ArgumentPromotion/aggregate-promote.ll
@@ -9,10 +9,10 @@ target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:1
i32 25 } ; <%QuadTy*> [#uses=1]
define internal i32 @test(%QuadTy* %P) {
- %A = getelementptr %QuadTy* %P, i64 0, i32 3 ; <i32*> [#uses=1]
- %B = getelementptr %QuadTy* %P, i64 0, i32 2 ; <i32*> [#uses=1]
- %a = load i32* %A ; <i32> [#uses=1]
- %b = load i32* %B ; <i32> [#uses=1]
+ %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
}
diff --git a/test/Transforms/ArgumentPromotion/attrs.ll b/test/Transforms/ArgumentPromotion/attrs.ll
index 49c075029951..46128f93c240 100644
--- a/test/Transforms/ArgumentPromotion/attrs.ll
+++ b/test/Transforms/ArgumentPromotion/attrs.ll
@@ -4,8 +4,8 @@
define internal void @f(%struct.ss* byval %b, i32* byval %X, i32 %i) nounwind {
entry:
- %tmp = getelementptr %struct.ss* %b, i32 0, i32 0
- %tmp1 = load i32* %tmp, align 4
+ %tmp = getelementptr %struct.ss, %struct.ss* %b, i32 0, i32 0
+ %tmp1 = load i32, i32* %tmp, align 4
%tmp2 = add i32 %tmp1, 1
store i32 %tmp2, i32* %tmp, align 4
@@ -16,9 +16,9 @@ entry:
define i32 @test(i32* %X) {
entry:
%S = alloca %struct.ss ; <%struct.ss*> [#uses=4]
- %tmp1 = getelementptr %struct.ss* %S, i32 0, i32 0 ; <i32*> [#uses=1]
+ %tmp1 = getelementptr %struct.ss, %struct.ss* %S, i32 0, i32 0 ; <i32*> [#uses=1]
store i32 1, i32* %tmp1, align 8
- %tmp4 = getelementptr %struct.ss* %S, i32 0, i32 1 ; <i64*> [#uses=1]
+ %tmp4 = getelementptr %struct.ss, %struct.ss* %S, i32 0, i32 1 ; <i64*> [#uses=1]
store i64 2, i64* %tmp4, align 4
call void @f( %struct.ss* byval %S, i32* byval %X, i32 zeroext 0)
ret i32 0
diff --git a/test/Transforms/ArgumentPromotion/basictest.ll b/test/Transforms/ArgumentPromotion/basictest.ll
index 8f78b98437bc..89888bbc98a7 100644
--- a/test/Transforms/ArgumentPromotion/basictest.ll
+++ b/test/Transforms/ArgumentPromotion/basictest.ll
@@ -3,8 +3,8 @@ target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:1
define internal i32 @test(i32* %X, i32* %Y) {
; CHECK-LABEL: define internal i32 @test(i32 %X.val, i32 %Y.val)
- %A = load i32* %X
- %B = load i32* %Y
+ %A = load i32, i32* %X
+ %B = load i32, i32* %Y
%C = add i32 %A, %B
ret i32 %C
}
diff --git a/test/Transforms/ArgumentPromotion/byval-2.ll b/test/Transforms/ArgumentPromotion/byval-2.ll
index b412f5ef0856..6c0288f5f989 100644
--- a/test/Transforms/ArgumentPromotion/byval-2.ll
+++ b/test/Transforms/ArgumentPromotion/byval-2.ll
@@ -8,8 +8,8 @@
define internal void @f(%struct.ss* byval %b, i32* byval %X) nounwind {
; CHECK-LABEL: define internal void @f(i32 %b.0, i64 %b.1, i32* byval %X)
entry:
- %tmp = getelementptr %struct.ss* %b, i32 0, i32 0
- %tmp1 = load i32* %tmp, align 4
+ %tmp = getelementptr %struct.ss, %struct.ss* %b, i32 0, i32 0
+ %tmp1 = load i32, i32* %tmp, align 4
%tmp2 = add i32 %tmp1, 1
store i32 %tmp2, i32* %tmp, align 4
@@ -21,9 +21,9 @@ define i32 @test(i32* %X) {
; CHECK-LABEL: define i32 @test
entry:
%S = alloca %struct.ss
- %tmp1 = getelementptr %struct.ss* %S, i32 0, i32 0
+ %tmp1 = getelementptr %struct.ss, %struct.ss* %S, i32 0, i32 0
store i32 1, i32* %tmp1, align 8
- %tmp4 = getelementptr %struct.ss* %S, i32 0, i32 1
+ %tmp4 = getelementptr %struct.ss, %struct.ss* %S, i32 0, i32 1
store i64 2, i64* %tmp4, align 4
call void @f( %struct.ss* byval %S, i32* byval %X)
; CHECK: call void @f(i32 %{{.*}}, i64 %{{.*}}, i32* byval %{{.*}})
diff --git a/test/Transforms/ArgumentPromotion/byval.ll b/test/Transforms/ArgumentPromotion/byval.ll
index 27305e92068d..b091b09a3597 100644
--- a/test/Transforms/ArgumentPromotion/byval.ll
+++ b/test/Transforms/ArgumentPromotion/byval.ll
@@ -7,8 +7,8 @@ target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:1
define internal void @f(%struct.ss* byval %b) nounwind {
; CHECK-LABEL: define internal void @f(i32 %b.0, i64 %b.1)
entry:
- %tmp = getelementptr %struct.ss* %b, i32 0, i32 0 ; <i32*> [#uses=2]
- %tmp1 = load i32* %tmp, align 4 ; <i32> [#uses=1]
+ %tmp = getelementptr %struct.ss, %struct.ss* %b, i32 0, i32 0 ; <i32*> [#uses=2]
+ %tmp1 = load i32, i32* %tmp, align 4 ; <i32> [#uses=1]
%tmp2 = add i32 %tmp1, 1 ; <i32> [#uses=1]
store i32 %tmp2, i32* %tmp, align 4
ret void
@@ -18,9 +18,9 @@ define i32 @main() nounwind {
; CHECK-LABEL: define i32 @main
entry:
%S = alloca %struct.ss ; <%struct.ss*> [#uses=4]
- %tmp1 = getelementptr %struct.ss* %S, i32 0, i32 0 ; <i32*> [#uses=1]
+ %tmp1 = getelementptr %struct.ss, %struct.ss* %S, i32 0, i32 0 ; <i32*> [#uses=1]
store i32 1, i32* %tmp1, align 8
- %tmp4 = getelementptr %struct.ss* %S, i32 0, i32 1 ; <i64*> [#uses=1]
+ %tmp4 = getelementptr %struct.ss, %struct.ss* %S, i32 0, i32 1 ; <i64*> [#uses=1]
store i64 2, i64* %tmp4, align 4
call void @f( %struct.ss* byval %S ) nounwind
; CHECK: call void @f(i32 %{{.*}}, i64 %{{.*}})
diff --git a/test/Transforms/ArgumentPromotion/chained.ll b/test/Transforms/ArgumentPromotion/chained.ll
index c9a453899d7a..6ba2e8d48694 100644
--- a/test/Transforms/ArgumentPromotion/chained.ll
+++ b/test/Transforms/ArgumentPromotion/chained.ll
@@ -5,8 +5,8 @@ target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:1
@G2 = constant i32* @G1 ; <i32**> [#uses=1]
define internal i32 @test(i32** %X) {
- %Y = load i32** %X ; <i32*> [#uses=1]
- %X.upgrd.1 = load i32* %Y ; <i32> [#uses=1]
+ %Y = load i32*, i32** %X ; <i32*> [#uses=1]
+ %X.upgrd.1 = load i32, i32* %Y ; <i32> [#uses=1]
ret i32 %X.upgrd.1
}
diff --git a/test/Transforms/ArgumentPromotion/control-flow.ll b/test/Transforms/ArgumentPromotion/control-flow.ll
index e4a61da45cf3..cdff36eb83c0 100644
--- a/test/Transforms/ArgumentPromotion/control-flow.ll
+++ b/test/Transforms/ArgumentPromotion/control-flow.ll
@@ -8,7 +8,7 @@ T: ; preds = %0
ret i32 17
F: ; preds = %0
- %X = load i32* %P ; <i32> [#uses=1]
+ %X = load i32, i32* %P ; <i32> [#uses=1]
ret i32 %X
}
diff --git a/test/Transforms/ArgumentPromotion/control-flow2.ll b/test/Transforms/ArgumentPromotion/control-flow2.ll
index 2543218bafe8..7413f46a860f 100644
--- a/test/Transforms/ArgumentPromotion/control-flow2.ll
+++ b/test/Transforms/ArgumentPromotion/control-flow2.ll
@@ -1,5 +1,6 @@
-; RUN: opt < %s -argpromotion -S | \
-; RUN: grep "load i32\* %A"
+; RUN: opt < %s -argpromotion -S | FileCheck %s
+
+; CHECK: load i32, i32* %A
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"
define internal i32 @callee(i1 %C, i32* %P) {
@@ -9,7 +10,7 @@ T: ; preds = %0
ret i32 17
F: ; preds = %0
- %X = load i32* %P ; <i32> [#uses=1]
+ %X = load i32, i32* %P ; <i32> [#uses=1]
ret i32 %X
}
diff --git a/test/Transforms/ArgumentPromotion/crash.ll b/test/Transforms/ArgumentPromotion/crash.ll
index 5e1a0370dbb1..dbd343ae920e 100644
--- a/test/Transforms/ArgumentPromotion/crash.ll
+++ b/test/Transforms/ArgumentPromotion/crash.ll
@@ -50,10 +50,10 @@ init:
define internal i32 @"clay_assign(Chain, Chain)"(%0* %c, %0* %d) {
init:
- %0 = getelementptr %0* %d, i32 0, i32 0
- %1 = load %0** %0
- %2 = getelementptr %0* %c, i32 0, i32 0
- %3 = load %0** %2
+ %0 = getelementptr %0, %0* %d, i32 0, i32 0
+ %1 = load %0*, %0** %0
+ %2 = getelementptr %0, %0* %c, i32 0, i32 0
+ %3 = load %0*, %0** %2
%4 = call i32 @"clay_assign(Chain, Chain)"(%0* %3, %0* %1)
ret i32 0
}
diff --git a/test/Transforms/ArgumentPromotion/dbg.ll b/test/Transforms/ArgumentPromotion/dbg.ll
index 65cf3678bd99..17a34cb62239 100644
--- a/test/Transforms/ArgumentPromotion/dbg.ll
+++ b/test/Transforms/ArgumentPromotion/dbg.ll
@@ -1,12 +1,12 @@
; RUN: opt < %s -argpromotion -S | FileCheck %s
; CHECK: call void @test(i32 %
-; CHECK: void (i32)* @test, {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [test]
+; CHECK: !DISubprogram(name: "test",{{.*}} function: void (i32)* @test
declare void @sink(i32)
define internal void @test(i32** %X) {
- %1 = load i32** %X, align 8
- %2 = load i32* %1, align 8
+ %1 = load i32*, i32** %X, align 8
+ %2 = load i32, i32* %1, align 8
call void @sink(i32 %2)
ret void
}
@@ -19,8 +19,9 @@ define void @caller(i32** %Y) {
!llvm.module.flags = !{!0}
!llvm.dbg.cu = !{!3}
-!0 = !{i32 2, !"Debug Info Version", i32 2}
-!1 = !MDLocation(line: 8, scope: !2)
-!2 = !{!"0x2e\00test\00test\00\003\001\001\000\006\00256\000\003", null, null, null, null, void (i32**)* @test, null, null, null} ; [ DW_TAG_subprogram ]
-!3 = !{!"0x11\004\00clang version 3.5.0 \000\00\000\00\002", null, null, null, !4, null, null} ; [ DW_TAG_compile_unit ] [/usr/local/google/home/blaikie/dev/scratch/pr20038/reduce/<stdin>] [DW_LANG_C_plus_plus]
+!0 = !{i32 2, !"Debug Info Version", i32 3}
+!1 = !DILocation(line: 8, scope: !2)
+!2 = !DISubprogram(name: "test", line: 3, isLocal: true, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, scope: null, function: void (i32**)* @test)
+!3 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: 2, file: !5, subprograms: !4)
!4 = !{!2}
+!5 = !DIFile(filename: "test.c", directory: "")
diff --git a/test/Transforms/ArgumentPromotion/fp80.ll b/test/Transforms/ArgumentPromotion/fp80.ll
index a770d6013d6b..84ef603de82c 100644
--- a/test/Transforms/ArgumentPromotion/fp80.ll
+++ b/test/Transforms/ArgumentPromotion/fp80.ll
@@ -24,22 +24,22 @@ entry:
define internal i8 @UseLongDoubleUnsafely(%union.u* byval align 16 %arg) {
entry:
%bitcast = bitcast %union.u* %arg to %struct.s*
- %gep = getelementptr inbounds %struct.s* %bitcast, i64 0, i32 2
- %result = load i8* %gep
+ %gep = getelementptr inbounds %struct.s, %struct.s* %bitcast, i64 0, i32 2
+ %result = load i8, i8* %gep
ret i8 %result
}
; CHECK: internal x86_fp80 @UseLongDoubleSafely(x86_fp80 {{%.*}}) {
define internal x86_fp80 @UseLongDoubleSafely(%union.u* byval align 16 %arg) {
- %gep = getelementptr inbounds %union.u* %arg, i64 0, i32 0
- %fp80 = load x86_fp80* %gep
+ %gep = getelementptr inbounds %union.u, %union.u* %arg, i64 0, i32 0
+ %fp80 = load x86_fp80, x86_fp80* %gep
ret x86_fp80 %fp80
}
; CHECK: define internal i64 @AccessPaddingOfStruct(%struct.Foo* byval %a) {
define internal i64 @AccessPaddingOfStruct(%struct.Foo* byval %a) {
%p = bitcast %struct.Foo* %a to i64*
- %v = load i64* %p
+ %v = load i64, i64* %p
ret i64 %v
}
@@ -53,6 +53,6 @@ loop:
%phi = phi %struct.Foo* [ null, %entry ], [ %gep, %loop ]
%0 = phi %struct.Foo* [ %a, %entry ], [ %0, %loop ]
store %struct.Foo* %phi, %struct.Foo** %a_ptr
- %gep = getelementptr %struct.Foo* %a, i64 0
+ %gep = getelementptr %struct.Foo, %struct.Foo* %a, i64 0
br label %loop
}
diff --git a/test/Transforms/ArgumentPromotion/inalloca.ll b/test/Transforms/ArgumentPromotion/inalloca.ll
index 089a78f6b319..80bd6fdbc406 100644
--- a/test/Transforms/ArgumentPromotion/inalloca.ll
+++ b/test/Transforms/ArgumentPromotion/inalloca.ll
@@ -7,10 +7,10 @@ target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:1
; Argpromote + scalarrepl should change this to passing the two integers by value.
define internal i32 @f(%struct.ss* inalloca %s) {
entry:
- %f0 = getelementptr %struct.ss* %s, i32 0, i32 0
- %f1 = getelementptr %struct.ss* %s, i32 0, i32 1
- %a = load i32* %f0, align 4
- %b = load i32* %f1, align 4
+ %f0 = getelementptr %struct.ss, %struct.ss* %s, i32 0, i32 0
+ %f1 = getelementptr %struct.ss, %struct.ss* %s, i32 0, i32 1
+ %a = load i32, i32* %f0, align 4
+ %b = load i32, i32* %f1, align 4
%r = add i32 %a, %b
ret i32 %r
}
@@ -21,8 +21,8 @@ entry:
define i32 @main() {
entry:
%S = alloca inalloca %struct.ss
- %f0 = getelementptr %struct.ss* %S, i32 0, i32 0
- %f1 = getelementptr %struct.ss* %S, i32 0, i32 1
+ %f0 = getelementptr %struct.ss, %struct.ss* %S, i32 0, i32 0
+ %f1 = getelementptr %struct.ss, %struct.ss* %S, i32 0, i32 1
store i32 1, i32* %f0, align 4
store i32 2, i32* %f1, align 4
%r = call i32 @f(%struct.ss* inalloca %S)
diff --git a/test/Transforms/ArgumentPromotion/reserve-tbaa.ll b/test/Transforms/ArgumentPromotion/reserve-tbaa.ll
index db9d70d337a1..3c8ed79eeb29 100644
--- a/test/Transforms/ArgumentPromotion/reserve-tbaa.ll
+++ b/test/Transforms/ArgumentPromotion/reserve-tbaa.ll
@@ -14,9 +14,9 @@
define internal fastcc void @fn(i32* nocapture readonly %p1, i64* nocapture readonly %p2) {
entry:
- %0 = load i64* %p2, align 8, !tbaa !1
+ %0 = load i64, i64* %p2, align 8, !tbaa !1
%conv = trunc i64 %0 to i32
- %1 = load i32* %p1, align 4, !tbaa !5
+ %1 = load i32, i32* %p1, align 4, !tbaa !5
%conv1 = trunc i32 %1 to i8
store i8 %conv1, i8* @d, align 1, !tbaa !7
ret void
@@ -26,11 +26,11 @@ define i32 @main() {
entry:
; CHECK-LABEL: main
; CHECK: store i32 1, i32* %{{.*}}, align 4, !tbaa ![[I32:[0-9]+]]
-; CHECK: %g.val = load i32* @g, align 4, !tbaa ![[I32]]
-; CHECK: %c.val = load i64* @c, align 8, !tbaa ![[LONG:[0-9]+]]
- %0 = load i32*** @e, align 8, !tbaa !8
+; CHECK: %g.val = load i32, i32* @g, align 4, !tbaa ![[I32]]
+; CHECK: %c.val = load i64, i64* @c, align 8, !tbaa ![[LONG:[0-9]+]]
+ %0 = load i32**, i32*** @e, align 8, !tbaa !8
store i32* @g, i32** %0, align 8, !tbaa !8
- %1 = load i32** @a, align 8, !tbaa !8
+ %1 = load i32*, i32** @a, align 8, !tbaa !8
store i32 1, i32* %1, align 4, !tbaa !5
call fastcc void @fn(i32* @g, i64* @c)
diff --git a/test/Transforms/ArgumentPromotion/variadic.ll b/test/Transforms/ArgumentPromotion/variadic.ll
index 0ae52b3bbbd1..0e03882d3b20 100644
--- a/test/Transforms/ArgumentPromotion/variadic.ll
+++ b/test/Transforms/ArgumentPromotion/variadic.ll
@@ -15,7 +15,7 @@ target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: nounwind uwtable
define i32 @main(i32 %argc, i8** nocapture readnone %argv) #0 {
entry:
- tail call void (i8*, i8*, i8*, i8*, i8*, ...)* @callee_t0f(i8* undef, i8* undef, i8* undef, i8* undef, i8* undef, %struct.tt0* byval align 8 @t45)
+ tail call void (i8*, i8*, i8*, i8*, i8*, ...) @callee_t0f(i8* undef, i8* undef, i8* undef, i8* undef, i8* undef, %struct.tt0* byval align 8 @t45)
ret i32 0
}