llvm.org GIT mirror llvm / 5ae21fb
rename *.llx -> *.ll, last batch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49971 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 11 years ago
92 changed file(s) with 1277 addition(s) and 1277 deletion(s). Raw diff Collapse all Expand all
0 ; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | \
1 ; RUN: llvm-dis | not grep load
2
3 @X = constant [2 x i32] [i32 4, i32 5]
4
5 define i32 @test(i32* %Y, i64 %idx) {
6 %P = getelementptr [2 x i32]* @X, i64 0, i64 %idx
7 %A = load i32* %P ; Load from invariant memory
8 store i32 4, i32* %Y ; Store could not be to @X
9 %B = load i32* %P
10 %C = sub i32 %A, %B
11 ret i32 %C
12 }
+0
-13
test/Analysis/BasicAA/2004-01-29-InvariantMemory.llx less more
None ; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | \
1 ; RUN: llvm-dis | not grep load
2
3 @X = constant [2 x i32] [i32 4, i32 5]
4
5 define i32 @test(i32* %Y, i64 %idx) {
6 %P = getelementptr [2 x i32]* @X, i64 0, i64 %idx
7 %A = load i32* %P ; Load from invariant memory
8 store i32 4, i32* %Y ; Store could not be to @X
9 %B = load i32* %P
10 %C = sub i32 %A, %B
11 ret i32 %C
12 }
0 ; RUN: llvm-as < %s | opt -dse | llvm-dis | grep {store i32 0}
1
2 define void @test({i32,i32 }* %P) {
3 %Q = getelementptr {i32,i32}* %P, i32 1
4 %X = getelementptr {i32,i32}* %Q, i32 0, i32 1
5 %Y = getelementptr {i32,i32}* %Q, i32 1, i32 1
6 store i32 0, i32* %X
7 store i32 1, i32* %Y
8 ret void
9 }
+0
-10
test/Analysis/BasicAA/2004-07-28-MustAliasbug.llx less more
None ; RUN: llvm-as < %s | opt -dse | llvm-dis | grep {store i32 0}
1
2 define void @test({i32,i32 }* %P) {
3 %Q = getelementptr {i32,i32}* %P, i32 1
4 %X = getelementptr {i32,i32}* %Q, i32 0, i32 1
5 %Y = getelementptr {i32,i32}* %Q, i32 1, i32 1
6 store i32 0, i32* %X
7 store i32 1, i32* %Y
8 ret void
9 }
0 ; This testcase shoudl return with an exit code of 1.
1 ;
2 ; RUN: llvm-as < %s | not lli
3
4 @test = global i64 0 ; [#uses=1]
5
6 define internal i64 @test.upgrd.1() {
7 %tmp.0 = load i64* @test ; [#uses=1]
8 %tmp.1 = add i64 %tmp.0, 1 ; [#uses=1]
9 ret i64 %tmp.1
10 }
11
12 define i32 @main() {
13 %L = call i64 @test.upgrd.1( ) ; [#uses=1]
14 %I = trunc i64 %L to i32 ; [#uses=1]
15 ret i32 %I
16 }
17
18
+0
-19
test/ExecutionEngine/2003-05-06-LivenessClobber.llx less more
None ; This testcase shoudl return with an exit code of 1.
1 ;
2 ; RUN: llvm-as < %s | not lli
3
4 @test = global i64 0 ; [#uses=1]
5
6 define internal i64 @test.upgrd.1() {
7 %tmp.0 = load i64* @test ; [#uses=1]
8 %tmp.1 = add i64 %tmp.0, 1 ; [#uses=1]
9 ret i64 %tmp.1
10 }
11
12 define i32 @main() {
13 %L = call i64 @test.upgrd.1( ) ; [#uses=1]
14 %I = trunc i64 %L to i32 ; [#uses=1]
15 ret i32 %I
16 }
17
18
0 ; RUN: llvm-as < %s | lli - test
1
2 declare i32 @puts(i8*)
3
4 define i32 @main(i32 %argc.1, i8** %argv.1) {
5 %tmp.5 = getelementptr i8** %argv.1, i64 1 ; [#uses=1]
6 %tmp.6 = load i8** %tmp.5 ; [#uses=1]
7 %tmp.0 = call i32 @puts( i8* %tmp.6 ) ; [#uses=0]
8 ret i32 0
9 }
10
+0
-11
test/ExecutionEngine/2003-05-07-ArgumentTest.llx less more
None ; RUN: llvm-as < %s | lli - test
1
2 declare i32 @puts(i8*)
3
4 define i32 @main(i32 %argc.1, i8** %argv.1) {
5 %tmp.5 = getelementptr i8** %argv.1, i64 1 ; [#uses=1]
6 %tmp.6 = load i8** %tmp.5 ; [#uses=1]
7 %tmp.0 = call i32 @puts( i8* %tmp.6 ) ; [#uses=0]
8 ret i32 0
9 }
10
0 ; This testcase was failing because without merging the return blocks, ADCE
1 ; didn't know that it could get rid of the then.0 block.
2
3 ; RUN: llvm-as < %s | opt -adce | llvm-dis | not grep load
4
5
6 define void @main(i32 %argc, i8** %argv) {
7 entry:
8 call void @__main( )
9 %tmp.1 = icmp ule i32 %argc, 5 ; [#uses=1]
10 br i1 %tmp.1, label %then.0, label %return
11
12 then.0: ; preds = %entry
13 %tmp.8 = load i8** %argv ; [#uses=1]
14 %tmp.10 = load i8* %tmp.8 ; [#uses=1]
15 %tmp.11 = icmp eq i8 %tmp.10, 98 ; [#uses=1]
16 br i1 %tmp.11, label %then.1, label %return
17
18 then.1: ; preds = %then.0
19 ret void
20
21 return: ; preds = %then.0, %entry
22 ret void
23 }
24
25 declare void @__main()
26
+0
-27
test/Transforms/ADCE/2003-12-19-MergeReturn.llx less more
None ; This testcase was failing because without merging the return blocks, ADCE
1 ; didn't know that it could get rid of the then.0 block.
2
3 ; RUN: llvm-as < %s | opt -adce | llvm-dis | not grep load
4
5
6 define void @main(i32 %argc, i8** %argv) {
7 entry:
8 call void @__main( )
9 %tmp.1 = icmp ule i32 %argc, 5 ; [#uses=1]
10 br i1 %tmp.1, label %then.0, label %return
11
12 then.0: ; preds = %entry
13 %tmp.8 = load i8** %argv ; [#uses=1]
14 %tmp.10 = load i8* %tmp.8 ; [#uses=1]
15 %tmp.11 = icmp eq i8 %tmp.10, 98 ; [#uses=1]
16 br i1 %tmp.11, label %then.1, label %return
17
18 then.1: ; preds = %then.0
19 ret void
20
21 return: ; preds = %then.0, %entry
22 ret void
23 }
24
25 declare void @__main()
26
0 ; RUN: llvm-as < %s | opt -adce -disable-output
1
2 define void @test() {
3 entry:
4 br label %UnifiedReturnBlock
5
6 UnifiedReturnBlock: ; preds = %invoke_catch.0, %entry
7 ret void
8
9 invoke_catch.0: ; No predecessors!
10 br i1 false, label %UnifiedUnwindBlock, label %UnifiedReturnBlock
11
12 UnifiedUnwindBlock: ; preds = %invoke_catch.0
13 unwind
14 }
15
+0
-16
test/Transforms/ADCE/2004-05-04-UnreachableBlock.llx less more
None ; RUN: llvm-as < %s | opt -adce -disable-output
1
2 define void @test() {
3 entry:
4 br label %UnifiedReturnBlock
5
6 UnifiedReturnBlock: ; preds = %invoke_catch.0, %entry
7 ret void
8
9 invoke_catch.0: ; No predecessors!
10 br i1 false, label %UnifiedUnwindBlock, label %UnifiedReturnBlock
11
12 UnifiedUnwindBlock: ; preds = %invoke_catch.0
13 unwind
14 }
15
0 ; RUN: llvm-as < %s | opt -dse | llvm-dis | not grep DEAD
1
2 define void @test(i32* %Q) {
3 %P = alloca i32 ; [#uses=1]
4 %DEAD = load i32* %Q ; [#uses=1]
5 store i32 %DEAD, i32* %P
6 ret void
7 }
8
+0
-9
test/Transforms/DeadStoreElimination/alloca.llx less more
None ; RUN: llvm-as < %s | opt -dse | llvm-dis | not grep DEAD
1
2 define void @test(i32* %Q) {
3 %P = alloca i32 ; [#uses=1]
4 %DEAD = load i32* %Q ; [#uses=1]
5 store i32 %DEAD, i32* %P
6 ret void
7 }
8
0 ; RUN: llvm-as < %s | opt -dse | llvm-dis | not grep DEAD
1
2 declare void @ext()
3
4 define i32* @caller() {
5 %P = malloc i32 ; [#uses=4]
6 %DEAD = load i32* %P ; [#uses=1]
7 %DEAD2 = add i32 %DEAD, 1 ; [#uses=1]
8 store i32 %DEAD2, i32* %P
9 call void @ext( )
10 store i32 0, i32* %P
11 ret i32* %P
12 }
13
+0
-14
test/Transforms/DeadStoreElimination/context-sensitive.llx less more
None ; RUN: llvm-as < %s | opt -dse | llvm-dis | not grep DEAD
1
2 declare void @ext()
3
4 define i32* @caller() {
5 %P = malloc i32 ; [#uses=4]
6 %DEAD = load i32* %P ; [#uses=1]
7 %DEAD2 = add i32 %DEAD, 1 ; [#uses=1]
8 store i32 %DEAD2, i32* %P
9 call void @ext( )
10 store i32 0, i32* %P
11 ret i32* %P
12 }
13
0 ; RUN: llvm-as < %s | opt -dse | llvm-dis | not grep DEAD
1
2 define void @test(i32* %Q, i32* %P) {
3 %DEAD = load i32* %Q ; [#uses=1]
4 store i32 %DEAD, i32* %P
5 free i32* %P
6 ret void
7 }
+0
-8
test/Transforms/DeadStoreElimination/free.llx less more
None ; RUN: llvm-as < %s | opt -dse | llvm-dis | not grep DEAD
1
2 define void @test(i32* %Q, i32* %P) {
3 %DEAD = load i32* %Q ; [#uses=1]
4 store i32 %DEAD, i32* %P
5 free i32* %P
6 ret void
7 }
0 ; RUN: llvm-as < %s | opt -dse | llvm-dis | not grep DEAD
1
2 define void @test(i32* %Q, i32* %P) {
3 %DEAD = load i32* %Q ; [#uses=1]
4 store i32 %DEAD, i32* %P
5 store i32 0, i32* %P
6 ret void
7 }
8
+0
-9
test/Transforms/DeadStoreElimination/simple.llx less more
None ; RUN: llvm-as < %s | opt -dse | llvm-dis | not grep DEAD
1
2 define void @test(i32* %Q, i32* %P) {
3 %DEAD = load i32* %Q ; [#uses=1]
4 store i32 %DEAD, i32* %P
5 store i32 0, i32* %P
6 ret void
7 }
8
0 ; RUN: llvm-as < %s | opt -globalopt
1
2 @V = global float 1.200000e+01 ; [#uses=1]
3 @G = internal global i32* null ; [#uses=2]
4
5 define i32 @user() {
6 %P = load i32** @G ; [#uses=1]
7 %Q = load i32* %P ; [#uses=1]
8 ret i32 %Q
9 }
10
11 define void @setter() {
12 %Vi = bitcast float* @V to i32* ; [#uses=1]
13 store i32* %Vi, i32** @G
14 ret void
15 }
16
+0
-17
test/Transforms/GlobalOpt/2004-10-10-CastStoreOnce.llx less more
None ; RUN: llvm-as < %s | opt -globalopt
1
2 @V = global float 1.200000e+01 ; [#uses=1]
3 @G = internal global i32* null ; [#uses=2]
4
5 define i32 @user() {
6 %P = load i32** @G ; [#uses=1]
7 %Q = load i32* %P ; [#uses=1]
8 ret i32 %Q
9 }
10
11 define void @setter() {
12 %Vi = bitcast float* @V to i32* ; [#uses=1]
13 store i32* %Vi, i32** @G
14 ret void
15 }
16
0 ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep global
1
2 @X = internal global i32 4 ; [#uses=1]
3
4 define i32 @foo() {
5 %V = load i32* @X ; [#uses=1]
6 ret i32 %V
7 }
8
+0
-9
test/Transforms/GlobalOpt/basictest.llx less more
None ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep global
1
2 @X = internal global i32 4 ; [#uses=1]
3
4 define i32 @foo() {
5 %V = load i32* @X ; [#uses=1]
6 ret i32 %V
7 }
8
0 ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep internal
1
2 @G = internal global i32 123 ; [#uses=1]
3
4 define void @foo() {
5 store i32 1, i32* @G
6 ret void
7 }
8
+0
-9
test/Transforms/GlobalOpt/deadglobal.llx less more
None ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep internal
1
2 @G = internal global i32 123 ; [#uses=1]
3
4 define void @foo() {
5 store i32 1, i32* @G
6 ret void
7 }
8
0 ; In this case, the global can only be broken up by one level.
1
2 ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep 12345
3
4 @G = internal global { i32, [4 x float] } zeroinitializer ; <{ i32, [4 x float] }*> [#uses=3]
5
6 define void @onlystore() {
7 store i32 12345, i32* getelementptr ({ i32, [4 x float] }* @G, i32 0, i32 0)
8 ret void
9 }
10
11 define void @storeinit(i32 %i) {
12 %Ptr = getelementptr { i32, [4 x float] }* @G, i32 0, i32 1, i32 %i ; [#uses=1]
13 store float 1.000000e+00, float* %Ptr
14 ret void
15 }
16
17 define float @readval(i32 %i) {
18 %Ptr = getelementptr { i32, [4 x float] }* @G, i32 0, i32 1, i32 %i ; [#uses=1]
19 %V = load float* %Ptr ; [#uses=1]
20 ret float %V
21 }
22
+0
-23
test/Transforms/GlobalOpt/globalsra-partial.llx less more
None ; In this case, the global can only be broken up by one level.
1
2 ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep 12345
3
4 @G = internal global { i32, [4 x float] } zeroinitializer ; <{ i32, [4 x float] }*> [#uses=3]
5
6 define void @onlystore() {
7 store i32 12345, i32* getelementptr ({ i32, [4 x float] }* @G, i32 0, i32 0)
8 ret void
9 }
10
11 define void @storeinit(i32 %i) {
12 %Ptr = getelementptr { i32, [4 x float] }* @G, i32 0, i32 1, i32 %i ; [#uses=1]
13 store float 1.000000e+00, float* %Ptr
14 ret void
15 }
16
17 define float @readval(i32 %i) {
18 %Ptr = getelementptr { i32, [4 x float] }* @G, i32 0, i32 1, i32 %i ; [#uses=1]
19 %V = load float* %Ptr ; [#uses=1]
20 ret float %V
21 }
22
0 ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep global
1
2 @G = internal global { i32, float, { double } } {
3 i32 1,
4 float 1.000000e+00,
5 { double } { double 1.727000e+01 } } ; <{ i32, float, { double } }*> [#uses=3]
6
7 define void @onlystore() {
8 store i32 123, i32* getelementptr ({ i32, float, { double } }* @G, i32 0, i32 0)
9 ret void
10 }
11
12 define float @storeinit() {
13 store float 1.000000e+00, float* getelementptr ({ i32, float, { double } }* @G, i32 0, i32 1)
14 %X = load float* getelementptr ({ i32, float, { double } }* @G, i32 0, i32 1) ; [#uses=1]
15 ret float %X
16 }
17
18 define double @constantize() {
19 %X = load double* getelementptr ({ i32, float, { double } }* @G, i32 0, i32 2, i32 0) ; [#uses=1]
20 ret double %X
21 }
22
+0
-23
test/Transforms/GlobalOpt/globalsra.llx less more
None ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep global
1
2 @G = internal global { i32, float, { double } } {
3 i32 1,
4 float 1.000000e+00,
5 { double } { double 1.727000e+01 } } ; <{ i32, float, { double } }*> [#uses=3]
6
7 define void @onlystore() {
8 store i32 123, i32* getelementptr ({ i32, float, { double } }* @G, i32 0, i32 0)
9 ret void
10 }
11
12 define float @storeinit() {
13 store float 1.000000e+00, float* getelementptr ({ i32, float, { double } }* @G, i32 0, i32 1)
14 %X = load float* getelementptr ({ i32, float, { double } }* @G, i32 0, i32 1) ; [#uses=1]
15 ret float %X
16 }
17
18 define double @constantize() {
19 %X = load double* getelementptr ({ i32, float, { double } }* @G, i32 0, i32 2, i32 0) ; [#uses=1]
20 ret double %X
21 }
22
0 ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep %G
1
2 @G = internal global i32 0 ; [#uses=1]
3 @H = internal global { i32* } { i32* @G } ; <{ i32* }*> [#uses=1]
4
5 define i32 @loadg() {
6 %G = load i32** getelementptr ({ i32* }* @H, i32 0, i32 0) ; [#uses=1]
7 %GV = load i32* %G ; [#uses=1]
8 ret i32 %GV
9 }
10
+0
-11
test/Transforms/GlobalOpt/iterate.llx less more
None ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep %G
1
2 @G = internal global i32 0 ; [#uses=1]
3 @H = internal global { i32* } { i32* @G } ; <{ i32* }*> [#uses=1]
4
5 define i32 @loadg() {
6 %G = load i32** getelementptr ({ i32* }* @H, i32 0, i32 0) ; [#uses=1]
7 %GV = load i32* %G ; [#uses=1]
8 ret i32 %GV
9 }
10
0 ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep G
1
2 @G = internal global i32 17 ; [#uses=3]
3
4 define void @foo() {
5 %V = load i32* @G ; [#uses=1]
6 store i32 %V, i32* @G
7 ret void
8 }
9
10 define i32 @bar() {
11 %X = load i32* @G ; [#uses=1]
12 ret i32 %X
13 }
14
+0
-15
test/Transforms/GlobalOpt/load-store-global.llx less more
None ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep G
1
2 @G = internal global i32 17 ; [#uses=3]
3
4 define void @foo() {
5 %V = load i32* @G ; [#uses=1]
6 store i32 %V, i32* @G
7 ret void
8 }
9
10 define i32 @bar() {
11 %X = load i32* @G ; [#uses=1]
12 ret i32 %X
13 }
14
0 ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep global
1
2 @G = internal global i32* null ; [#uses=3]
3
4 define void @init() {
5 %P = malloc i32 ; [#uses=1]
6 store i32* %P, i32** @G
7 %GV = load i32** @G ; [#uses=1]
8 store i32 0, i32* %GV
9 ret void
10 }
11
12 define i32 @get() {
13 %GV = load i32** @G ; [#uses=1]
14 %V = load i32* %GV ; [#uses=1]
15 ret i32 %V
16 }
17
+0
-18
test/Transforms/GlobalOpt/malloc-promote-1.llx less more
None ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep global
1
2 @G = internal global i32* null ; [#uses=3]
3
4 define void @init() {
5 %P = malloc i32 ; [#uses=1]
6 store i32* %P, i32** @G
7 %GV = load i32** @G ; [#uses=1]
8 store i32 0, i32* %GV
9 ret void
10 }
11
12 define i32 @get() {
13 %GV = load i32** @G ; [#uses=1]
14 %V = load i32* %GV ; [#uses=1]
15 ret i32 %V
16 }
17
0 ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep malloc
1
2 @G = internal global i32* null ; [#uses=3]
3
4 define void @init() {
5 %P = malloc i32, i32 100 ; [#uses=1]
6 store i32* %P, i32** @G
7 %GV = load i32** @G ; [#uses=1]
8 %GVe = getelementptr i32* %GV, i32 40 ; [#uses=1]
9 store i32 20, i32* %GVe
10 ret void
11 }
12
13 define i32 @get() {
14 %GV = load i32** @G ; [#uses=1]
15 %GVe = getelementptr i32* %GV, i32 40 ; [#uses=1]
16 %V = load i32* %GVe ; [#uses=1]
17 ret i32 %V
18 }
19
+0
-20
test/Transforms/GlobalOpt/malloc-promote-2.llx less more
None ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep malloc
1
2 @G = internal global i32* null ; [#uses=3]
3
4 define void @init() {
5 %P = malloc i32, i32 100 ; [#uses=1]
6 store i32* %P, i32** @G
7 %GV = load i32** @G ; [#uses=1]
8 %GVe = getelementptr i32* %GV, i32 40 ; [#uses=1]
9 store i32 20, i32* %GVe
10 ret void
11 }
12
13 define i32 @get() {
14 %GV = load i32** @G ; [#uses=1]
15 %GVe = getelementptr i32* %GV, i32 40 ; [#uses=1]
16 %V = load i32* %GVe ; [#uses=1]
17 ret i32 %V
18 }
19
0 ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep malloc
1
2 @G = internal global i32* null ; [#uses=4]
3
4 define void @init() {
5 %P = malloc i32, i32 100 ; [#uses=1]
6 store i32* %P, i32** @G
7 %GV = load i32** @G ; [#uses=1]
8 %GVe = getelementptr i32* %GV, i32 40 ; [#uses=1]
9 store i32 20, i32* %GVe
10 ret void
11 }
12
13 define i32 @get() {
14 %GV = load i32** @G ; [#uses=1]
15 %GVe = getelementptr i32* %GV, i32 40 ; [#uses=1]
16 %V = load i32* %GVe ; [#uses=1]
17 ret i32 %V
18 }
19
20 define i1 @check() {
21 %GV = load i32** @G ; [#uses=1]
22 %V = icmp eq i32* %GV, null ; [#uses=1]
23 ret i1 %V
24 }
25
+0
-26
test/Transforms/GlobalOpt/malloc-promote-3.llx less more
None ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep malloc
1
2 @G = internal global i32* null ; [#uses=4]
3
4 define void @init() {
5 %P = malloc i32, i32 100 ; [#uses=1]
6 store i32* %P, i32** @G
7 %GV = load i32** @G ; [#uses=1]
8 %GVe = getelementptr i32* %GV, i32 40 ; [#uses=1]
9 store i32 20, i32* %GVe
10 ret void
11 }
12
13 define i32 @get() {
14 %GV = load i32** @G ; [#uses=1]
15 %GVe = getelementptr i32* %GV, i32 40 ; [#uses=1]
16 %V = load i32* %GVe ; [#uses=1]
17 ret i32 %V
18 }
19
20 define i1 @check() {
21 %GV = load i32** @G ; [#uses=1]
22 %V = icmp eq i32* %GV, null ; [#uses=1]
23 ret i1 %V
24 }
25
0 ; Test that PHI nodes and select instructions do not necessarily make stuff
1 ; non-constant.
2
3 ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep global
4
5 @X = internal global i32 4 ; [#uses=2]
6 @Y = internal global i32 5 ; [#uses=2]
7
8 define i32 @test1(i1 %C) {
9 %P = select i1 %C, i32* @X, i32* @Y ; [#uses=1]
10 %V = load i32* %P ; [#uses=1]
11 ret i32 %V
12 }
13
14 define i32 @test2(i1 %C) {
15 ;
16 br i1 %C, label %T, label %Cont
17
18 T: ; preds = %0
19 br label %Cont
20
21 Cont: ; preds = %T, %0
22 %P = phi i32* [ @X, %0 ], [ @Y, %T ] ; [#uses=1]
23 %V = load i32* %P ; [#uses=1]
24 ret i32 %V
25 }
26
27
28
29
30
+0
-31
test/Transforms/GlobalOpt/phi-select.llx less more
None ; Test that PHI nodes and select instructions do not necessarily make stuff
1 ; non-constant.
2
3 ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep global
4
5 @X = internal global i32 4 ; [#uses=2]
6 @Y = internal global i32 5 ; [#uses=2]
7
8 define i32 @test1(i1 %C) {
9 %P = select i1 %C, i32* @X, i32* @Y ; [#uses=1]
10 %V = load i32* %P ; [#uses=1]
11 ret i32 %V
12 }
13
14 define i32 @test2(i1 %C) {
15 ;
16 br i1 %C, label %T, label %Cont
17
18 T: ; preds = %0
19 br label %Cont
20
21 Cont: ; preds = %T, %0
22 %P = phi i32* [ @X, %0 ], [ @Y, %T ] ; [#uses=1]
23 %V = load i32* %P ; [#uses=1]
24 ret i32 %V
25 }
26
27
28
29
30
0 ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | \
1 ; RUN: grep {call void @Actual}
2
3 ; Check that a comparison does not prevent an indirect call from being made
4 ; direct. The global will still remain, but indirect call elim is still good.
5
6 @G = internal global void ()* null ; [#uses=2]
7
8 define internal void @Actual() {
9 ret void
10 }
11
12 define void @init() {
13 store void ()* @Actual, void ()** @G
14 ret void
15 }
16
17 define void @doit() {
18 %FP = load void ()** @G ; [#uses=2]
19 %CC = icmp eq void ()* %FP, null ; [#uses=1]
20 br i1 %CC, label %isNull, label %DoCall
21
22 DoCall: ; preds = %0
23 call void %FP( )
24 ret void
25
26 isNull: ; preds = %0
27 ret void
28 }
29
+0
-30
test/Transforms/GlobalOpt/storepointer-compare.llx less more
None ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | \
1 ; RUN: grep {call void @Actual}
2
3 ; Check that a comparison does not prevent an indirect call from being made
4 ; direct. The global will still remain, but indirect call elim is still good.
5
6 @G = internal global void ()* null ; [#uses=2]
7
8 define internal void @Actual() {
9 ret void
10 }
11
12 define void @init() {
13 store void ()* @Actual, void ()** @G
14 ret void
15 }
16
17 define void @doit() {
18 %FP = load void ()** @G ; [#uses=2]
19 %CC = icmp eq void ()* %FP, null ; [#uses=1]
20 br i1 %CC, label %isNull, label %DoCall
21
22 DoCall: ; preds = %0
23 call void %FP( )
24 ret void
25
26 isNull: ; preds = %0
27 ret void
28 }
29
0 ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep global
1
2 @G = internal global void ()* null ; [#uses=2]
3
4 define internal void @Actual() {
5 ret void
6 }
7
8 define void @init() {
9 store void ()* @Actual, void ()** @G
10 ret void
11 }
12
13 define void @doit() {
14 %FP = load void ()** @G ; [#uses=1]
15 call void %FP( )
16 ret void
17 }
18
+0
-19
test/Transforms/GlobalOpt/storepointer.llx less more
None ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep global
1
2 @G = internal global void ()* null ; [#uses=2]
3
4 define internal void @Actual() {
5 ret void
6 }
7
8 define void @init() {
9 store void ()* @Actual, void ()** @G
10 ret void
11 }
12
13 define void @doit() {
14 %FP = load void ()** @G ; [#uses=1]
15 call void %FP( )
16 ret void
17 }
18
0 ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep G
1
2 @G = internal global i32 17 ; [#uses=3]
3
4 define void @foo() {
5 store i32 17, i32* @G
6 ret void
7 }
8
9 define i32 @bar() {
10 %X = load i32* @G ; [#uses=1]
11 ret i32 %X
12 }
13
14 define internal void @dead() {
15 store i32 123, i32* @G
16 ret void
17 }
18
+0
-19
test/Transforms/GlobalOpt/trivialstore.llx less more
None ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep G
1
2 @G = internal global i32 17 ; [#uses=3]
3
4 define void @foo() {
5 store i32 17, i32* @G
6 ret void
7 }
8
9 define i32 @bar() {
10 %X = load i32* @G ; [#uses=1]
11 ret i32 %X
12 }
13
14 define internal void @dead() {
15 store i32 123, i32* @G
16 ret void
17 }
18
0 ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep store
1
2 @llvm.global_ctors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__Z3foov } ] ; <[1 x { i32, void ()* }]*> [#uses=0]
3 @X.0 = internal global i32 undef ; [#uses=2]
4
5 define i32 @_Z3foov() {
6 entry:
7 %tmp.1 = load i32* @X.0 ; [#uses=1]
8 ret i32 %tmp.1
9 }
10
11 define internal void @_GLOBAL__I__Z3foov() {
12 entry:
13 store i32 1, i32* @X.0
14 ret void
15 }
16
+0
-17
test/Transforms/GlobalOpt/undef-init.llx less more
None ; RUN: llvm-as < %s | opt -globalopt | llvm-dis | not grep store
1
2 @llvm.global_ctors = appending global [1 x { i32, void ()* }] [ { i32, void ()* } { i32 65535, void ()* @_GLOBAL__I__Z3foov } ] ; <[1 x { i32, void ()* }]*> [#uses=0]
3 @X.0 = internal global i32 undef ; [#uses=2]
4
5 define i32 @_Z3foov() {
6 entry:
7 %tmp.1 = load i32* @X.0 ; [#uses=1]
8 ret i32 %tmp.1
9 }
10
11 define internal void @_GLOBAL__I__Z3foov() {
12 entry:
13 store i32 1, i32* @X.0
14 ret void
15 }
16
0 ; RUN: llvm-as < %s | opt -indvars -disable-output
1
2 define void @test() {
3 entry:
4 %inc.2 = add i32 1, 1 ; [#uses=1]
5 br i1 false, label %no_exit, label %loopexit
6
7 no_exit: ; preds = %no_exit, %entry
8 %j.0.pn = phi i32 [ %inc.3, %no_exit ], [ %inc.2, %entry ] ; [#uses=1]
9 %k.0.pn = phi i32 [ %inc.4, %no_exit ], [ 1, %entry ] ; [#uses=1]
10 %inc.3 = add i32 %j.0.pn, 1 ; [#uses=1]
11 %inc.4 = add i32 %k.0.pn, 1 ; [#uses=1]
12 br i1 false, label %no_exit, label %loopexit
13
14 loopexit: ; preds = %no_exit, %entry
15 ret void
16 }
17
+0
-18
test/Transforms/IndVarsSimplify/2003-12-10-RemoveInstrCrash.llx less more
None ; RUN: llvm-as < %s | opt -indvars -disable-output
1
2 define void @test() {
3 entry:
4 %inc.2 = add i32 1, 1 ; [#uses=1]
5 br i1 false, label %no_exit, label %loopexit
6
7 no_exit: ; preds = %no_exit, %entry
8 %j.0.pn = phi i32 [ %inc.3, %no_exit ], [ %inc.2, %entry ] ; [#uses=1]
9 %k.0.pn = phi i32 [ %inc.4, %no_exit ], [ 1, %entry ] ; [#uses=1]
10 %inc.3 = add i32 %j.0.pn, 1 ; [#uses=1]
11 %inc.4 = add i32 %k.0.pn, 1 ; [#uses=1]
12 br i1 false, label %no_exit, label %loopexit
13
14 loopexit: ; preds = %no_exit, %entry
15 ret void
16 }
17
0 ; RUN: llvm-as < %s | opt -indvars -disable-output
1 define void @_ZN17CoinFactorization7cleanupEv() {
2 entry:
3 br i1 false, label %loopexit.14, label %cond_continue.3
4
5 cond_continue.3: ; preds = %entry
6 ret void
7
8 loopexit.14: ; preds = %entry
9 %tmp.738 = sub i32 0, 0 ; [#uses=1]
10 br i1 false, label %no_exit.15.preheader, label %loopexit.15
11
12 no_exit.15.preheader: ; preds = %loopexit.14
13 br label %no_exit.15
14
15 no_exit.15: ; preds = %no_exit.15, %no_exit.15.preheader
16 %highC.0 = phi i32 [ %tmp.738, %no_exit.15.preheader ], [ %dec.0, %no_exit.15 ] ; [#uses=1]
17 %dec.0 = add i32 %highC.0, -1 ; [#uses=1]
18 br i1 false, label %no_exit.15, label %loopexit.15
19
20 loopexit.15: ; preds = %no_exit.15, %loopexit.14
21 ret void
22 }
23
+0
-24
test/Transforms/IndVarsSimplify/2003-12-15-Crash.llx less more
None ; RUN: llvm-as < %s | opt -indvars -disable-output
1 define void @_ZN17CoinFactorization7cleanupEv() {
2 entry:
3 br i1 false, label %loopexit.14, label %cond_continue.3
4
5 cond_continue.3: ; preds = %entry
6 ret void
7
8 loopexit.14: ; preds = %entry
9 %tmp.738 = sub i32 0, 0 ; [#uses=1]
10 br i1 false, label %no_exit.15.preheader, label %loopexit.15
11
12 no_exit.15.preheader: ; preds = %loopexit.14
13 br label %no_exit.15
14
15 no_exit.15: ; preds = %no_exit.15, %no_exit.15.preheader
16 %highC.0 = phi i32 [ %tmp.738, %no_exit.15.preheader ], [ %dec.0, %no_exit.15 ] ; [#uses=1]
17 %dec.0 = add i32 %highC.0, -1 ; [#uses=1]
18 br i1 false, label %no_exit.15, label %loopexit.15
19
20 loopexit.15: ; preds = %no_exit.15, %loopexit.14
21 ret void
22 }
23
0 ; RUN: llvm-as < %s | opt -indvars -disable-output
1 ; ModuleID = '2004-04-05-InvokeCastCrash.llx'
2 %struct.__false_type = type { i8 }
3 %"struct.__gnu_cxx::_Hashtable_node" = type { %"struct.__gnu_cxx::_Hashtable_node"*, %"struct.llvm::Constant"* }
4 %"struct.__gnu_cxx::_Hashtable_node >" = type { %"struct.__gnu_cxx::_Hashtable_node >"*, %"struct.std::pair" }
5 %"struct.__gnu_cxx::hash_map,std::equal_to,std::allocator >" = type { %"struct.__gnu_cxx::hashtable,const llvm::Value*,__gnu_cxx::hash,std::_Select1st >,std::equal_to,std::allocator >" }
6 %"struct.__gnu_cxx::hash_set,std::equal_to,std::allocator >" = type { %"struct.__gnu_cxx::hashtable,std::_Identity,std::equal_to,std::allocator >" }
7 %"struct.__gnu_cxx::hashtable,std::_Identity,std::equal_to,std::allocator >" = type { %struct.__false_type, %struct.__false_type, %struct.__false_type, %struct.__false_type, %"struct.std::vector<__gnu_cxx::_Hashtable_node*,std::allocator >", i32 }
8 %"struct.__gnu_cxx::hashtable,const llvm::Value*,__gnu_cxx::hash,std::_Select1st >,std::equal_to,std::allocator >" = type { %struct.__false_type, %struct.__false_type, %struct.__false_type, %struct.__false_type, %"struct.std::vector<__gnu_cxx::_Hashtable_node >*,std::allocator >", i32 }
9 %"struct.llvm::AbstractTypeUser" = type { i32 (...)** }
10 %"struct.llvm::Annotable" = type { i32 (...)**, %"struct.llvm::Annotation"* }
11 %"struct.llvm::Annotation" = type { i32 (...)**, %"struct.llvm::AnnotationID", %"struct.llvm::Annotation"* }
12 %"struct.llvm::AnnotationID" = type { i32 }
13 %"struct.llvm::Argument" = type { %"struct.llvm::Value", %"struct.llvm::Function"*, %"struct.llvm::Argument"*, %"struct.llvm::Argument"* }
14 %"struct.llvm::BasicBlock" = type { %"struct.llvm::Value", %"struct.llvm::iplist >", %"struct.llvm::BasicBlock"*, %"struct.llvm::BasicBlock"* }
15 %"struct.llvm::Constant" = type opaque
16 %"struct.llvm::DerivedType" = type { %"struct.llvm::Type", %"struct.llvm::AbstractTypeUser", %"struct.std::vector >" }
17 %"struct.llvm::Function" = type { %"struct.llvm::GlobalValue", %"struct.llvm::Annotable", %"struct.llvm::iplist >", %"struct.llvm::iplist >", %"struct.llvm::SymbolTable"*, %"struct.llvm::Function"*, %"struct.llvm::Function"* }
18 %"struct.llvm::FunctionPass" = type { %"struct.llvm::Pass" }
19 %"struct.llvm::FunctionType" = type { %"struct.llvm::DerivedType", i1 }
20 %"struct.llvm::GlobalValue" = type { %"struct.llvm::User", i32, %"struct.llvm::Module"* }
21 %"struct.llvm::Instruction" = type { %"struct.llvm::User", %"struct.llvm::Annotable", %"struct.llvm::BasicBlock"*, %"struct.llvm::Instruction"*, %"struct.llvm::Instruction"*, i32 }
22 %"struct.llvm::IntrinsicLowering" = type opaque
23 %"struct.llvm::MachineBasicBlock" = type { %"struct.llvm::ilist", %"struct.llvm::MachineBasicBlock"*, %"struct.llvm::MachineBasicBlock"*, %"struct.llvm::BasicBlock"* }
24 %"struct.llvm::MachineConstantPool" = type opaque
25 %"struct.llvm::MachineFrameInfo" = type opaque
26 %"struct.llvm::MachineFunction" = type { %"struct.llvm::Annotation", %"struct.llvm::Function"*, %"struct.llvm::TargetMachine"*, %"struct.llvm::iplist >", %"struct.llvm::SSARegMap"*, %"struct.llvm::MachineFunctionInfo"*, %"struct.llvm::MachineFrameInfo"*, %"struct.llvm::MachineConstantPool"* }
27 %"struct.llvm::MachineFunctionInfo" = type { %"struct.__gnu_cxx::hash_set,std::equal_to,std::allocator >", %"struct.__gnu_cxx::hash_map,std::equal_to,std::allocator >", i32, i32, i32, i32, i32, i32, i32, i1, i1, i1, %"struct.llvm::MachineFunction"* }
28 %"struct.llvm::MachineFunctionPass" = type { %"struct.llvm::FunctionPass" }
29 %"struct.llvm::MachineInstr" = type { i16, i8, %"struct.std::vector >", %"struct.llvm::MachineInstr"*, %"struct.llvm::MachineInstr"*, %"struct.llvm::MachineBasicBlock"* }
30 %"struct.llvm::MachineInstrBuilder" = type { %"struct.llvm::MachineInstr"* }
31 %"struct.llvm::MachineOperand" = type { %"union.llvm::MachineOperand::._65", i32, i32 }
32 %"struct.llvm::Module" = type opaque
33 %"struct.llvm::PATypeHandle" = type { %"struct.llvm::Type"*, %"struct.llvm::AbstractTypeUser"* }
34 %"struct.llvm::PATypeHolder" = type { %"struct.llvm::Type"* }
35 %"struct.llvm::Pass" = type { i32 (...)**, %"struct.llvm::AbstractTypeUser"*, %"struct.llvm::PassInfo"*, %"struct.std::vector,std::allocator > >" }
36 %"struct.llvm::PassInfo" = type { i8*, i8*, %"struct.std::type_info"*, i8, %"struct.std::vector >", %"struct.llvm::Pass"* ()*, %"struct.llvm::Pass"* (%"struct.llvm::TargetMachine"*)* }
37 %"struct.llvm::SSARegMap" = type opaque
38 %"struct.llvm::SymbolTable" = type opaque
39 %"struct.llvm::SymbolTableListTraits >" = type { %"struct.llvm::Function"*, %"struct.llvm::Function"* }
40 %"struct.llvm::SymbolTableListTraits >" = type { %"struct.llvm::Function"*, %"struct.llvm::BasicBlock"* }
41 %"struct.llvm::TargetData" = type { %"struct.llvm::FunctionPass", i1, i8, i8, i8, i8, i8, i8, i8, i8 }
42 %"struct.llvm::TargetFrameInfo" = type { i32 (...)**, i32, i32, i32 }
43 %"struct.llvm::TargetInstrDescriptor" = type { i8*, i32, i32, i32, i1, i32, i32, i32, i32, i32, i32*, i32* }
44 %"struct.llvm::TargetInstrInfo" = type { i32 (...)**, %"struct.llvm::TargetInstrDescriptor"*, i32, i32 }
45 %"struct.llvm::TargetMachine" = type { i32 (...)**, %"struct.std::basic_string,std::allocator >", %"struct.llvm::TargetData", %"struct.llvm::IntrinsicLowering"* }
46 %"struct.llvm::TargetRegClassInfo" = type { i32 (...)**, i32, i32, i32 }
47 %"struct.llvm::TargetRegInfo" = type { i32 (...)**, %"struct.std::vector >", %"struct.llvm::TargetMachine"* }
48 %"struct.llvm::Type" = type { %"struct.llvm::Value", i32, i32, i1, i32, %"struct.llvm::Type"*, %"struct.std::vector >" }
49 %"struct.llvm::Use" = type { %"struct.llvm::Value"*, %"struct.llvm::User"*, %"struct.llvm::Use"*, %"struct.llvm::Use"* }
50 %"struct.llvm::User" = type { %"struct.llvm::Value", %"struct.std::vector >" }
51 %"struct.llvm::Value" = type { i32 (...)**, %"struct.llvm::iplist >", %"struct.std::basic_string,std::allocator >", %"struct.llvm::PATypeHolder", i32 }
52 %"struct.llvm::_GLOBAL__N_::InsertPrologEpilogCode" = type { %"struct.llvm::MachineFunctionPass" }
53 %"struct.llvm::ilist" = type { %"struct.llvm::iplist >" }
54 %"struct.llvm::ilist_iterator" = type { %"struct.llvm::MachineBasicBlock"* }
55 %"struct.llvm::ilist_traits" = type { %"struct.llvm::SymbolTableListTraits >" }
56 %"struct.llvm::ilist_traits" = type { %"struct.llvm::SymbolTableListTraits >" }
57 %"struct.llvm::iplist >" = type { %"struct.llvm::ilist_traits", %"struct.llvm::Argument"*, %"struct.llvm::Argument"* }
58 %"struct.llvm::iplist >" = type { %"struct.llvm::ilist_traits", %"struct.llvm::BasicBlock"*, %"struct.llvm::BasicBlock"* }
59 %"struct.llvm::iplist >" = type { %"struct.llvm::ilist_traits", %"struct.llvm::Instruction"*, %"struct.llvm::Instruction"* }
60 %"struct.llvm::iplist >" = type { %"struct.llvm::MachineBasicBlock"*, %"struct.llvm::MachineBasicBlock"* }
61 %"struct.llvm::iplist >" = type { %"struct.llvm::ilist_iterator", %"struct.llvm::MachineInstr"*, %"struct.llvm::MachineInstr"* }
62 %"struct.llvm::iplist >" = type { %"struct.llvm::Use"*, %"struct.llvm::Use"* }
63 %"struct.std::_Vector_alloc_base<__gnu_cxx::_Hashtable_node*,std::allocator, true>" = type { %"struct.__gnu_cxx::_Hashtable_node"**, %"struct.__gnu_cxx::_Hashtable_node"**, %"struct.__gnu_cxx::_Hashtable_node"** }
64 %"struct.std::_Vector_alloc_base<__gnu_cxx::_Hashtable_node >*,std::allocator, true>" = type { %"struct.__gnu_cxx::_Hashtable_node >"**, %"struct.__gnu_cxx::_Hashtable_node >"**, %"struct.__gnu_cxx::_Hashtable_node >"** }
65 %"struct.std::_Vector_alloc_base, true>" = type { %"struct.llvm::PassInfo"**, %"struct.llvm::PassInfo"**, %"struct.llvm::PassInfo"** }
66 %"struct.std::_Vector_alloc_base, true>" = type { %"struct.llvm::TargetFrameInfo"**, %"struct.llvm::TargetFrameInfo"**, %"struct.llvm::TargetFrameInfo"** }
67 %"struct.std::_Vector_alloc_base, true>" = type { %"struct.llvm::AbstractTypeUser"**, %"struct.llvm::AbstractTypeUser"**, %"struct.llvm::AbstractTypeUser"** }
68 %"struct.std::_Vector_alloc_base, true>" = type { %"struct.llvm::MachineInstr"**, %"struct.llvm::MachineInstr"**, %"struct.llvm::MachineInstr"** }
69 %"struct.std::_Vector_alloc_base, true>" = type { %"struct.llvm::MachineOperand"*, %"struct.llvm::MachineOperand"*, %"struct.llvm::MachineOperand"* }
70 %"struct.std::_Vector_alloc_base, true>" = type { %"struct.llvm::PATypeHandle"*, %"struct.llvm::PATypeHandle"*, %"struct.llvm::PATypeHandle"* }
71 %"struct.std::_Vector_alloc_base, true>" = type { %"struct.llvm::Use"*, %"struct.llvm::Use"*, %"struct.llvm::Use"* }
72 %"struct.std::_Vector_alloc_base,std::allocator >, true>" = type { %"struct.std::pair"*, %"struct.std::pair"*, %"struct.std::pair"* }
73 %"struct.std::_Vector_base<__gnu_cxx::_Hashtable_node*,std::allocator >" = type { %"struct.std::_Vector_alloc_base<__gnu_cxx::_Hashtable_node*,std::allocator, true>" }
74 %"struct.std::_Vector_base<__gnu_cxx::_Hashtable_node >*,std::allocator >" = type { %"struct.std::_Vector_alloc_base<__gnu_cxx::_Hashtable_node >*,std::allocator, true>" }
75 %"struct.std::_Vector_base >" = type { %"struct.std::_Vector_alloc_base, true>" }
76 %"struct.std::_Vector_base >" = type { %"struct.std::_Vector_alloc_base, true>" }
77 %"struct.std::_Vector_base >" = type { %"struct.std::_Vector_alloc_base, true>" }
78 %"struct.std::_Vector_base >" = type { %"struct.std::_Vector_alloc_base, true>" }
79 %"struct.std::_Vector_base >" = type { %"struct.std::_Vector_alloc_base, true>" }
80 %"struct.std::_Vector_base >" = type { %"struct.std::_Vector_alloc_base, true>" }
81 %"struct.std::_Vector_base >" = type { %"struct.std::_Vector_alloc_base, true>" }
82 %"struct.std::_Vector_base,std::allocator > >" = type { %"struct.std::_Vector_alloc_base,std::allocator >, true>" }
83 %"struct.std::basic_string,std::allocator >" = type { %"struct.std::basic_string,std::allocator >::_Alloc_hider" }
84 %"struct.std::basic_string,std::allocator >::_Alloc_hider" = type { i8* }
85 %"struct.std::pair" = type { %"struct.llvm::PassInfo"*, %"struct.llvm::Pass"* }
86 %"struct.std::pair" = type { %"struct.llvm::Value"*, i32 }
87 %"struct.std::type_info" = type { i32 (...)**, i8* }
88 %"struct.std::vector<__gnu_cxx::_Hashtable_node*,std::allocator >" = type { %"struct.std::_Vector_base<__gnu_cxx::_Hashtable_node*,std::allocator >" }
89 %"struct.std::vector<__gnu_cxx::_Hashtable_node >*,std::allocator >" = type { %"struct.std::_Vector_base<__gnu_cxx::_Hashtable_node >*,std::allocator >" }
90 %"struct.std::vector >" = type { %"struct.std::_Vector_base >" }
91 %"struct.std::vector >" = type { %"struct.std::_Vector_base >" }
92 %"struct.std::vector >" = type { %"struct.std::_Vector_base >" }
93 %"struct.std::vector >" = type { %"struct.std::_Vector_base >" }
94 %"struct.std::vector >" = type { %"struct.std::_Vector_base >" }
95 %"struct.std::vector >" = type { %"struct.std::_Vector_base >" }
96 %"struct.std::vector >" = type { %"struct.std::_Vector_base >" }
97 %"struct.std::vector,std::allocator > >" = type { %"struct.std::_Vector_base,std::allocator > >" }
98 %"union.llvm::MachineOperand::._65" = type { %"struct.std::basic_string,std::allocator >"* }
99
100 declare void @_Znwj()
101
102 declare void @_ZN4llvm12MachineInstrC1Esjbb()
103
104 declare void @_ZNSt6vectorIPN4llvm12MachineInstrESaIS2_EE9push_backERKS2_()
105
106 declare void @_ZNK4llvm8Function15getFunctionTypeEv()
107
108 declare void @_ZNK4llvm19MachineInstrBuilder7addMRegEiNS_14MachineOperand7UseTypeE()
109
110 declare void @_ZNK4llvm19MachineInstrBuilder7addSImmEi()
111
112 define void @_ZN4llvm11_GLOBAL__N_22InsertPrologEpilogCode20runOnMachineFunctionERNS_15MachineFunctionE(%"struct.llvm::MachineFunction"* %F) {
113 entry:
114 %tmp.8.i = invoke %"struct.llvm::TargetFrameInfo"* null( %"struct.llvm::TargetMachine"* null )
115 to label %invoke_cont.0.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetFrameInfo"*> [#uses=0]
116
117 invoke_catch.0.i: ; preds = %invoke_cont.49.i, %invoke_cont.48.i, %invoke_cont.47.i, %invoke_cont.i53.i, %no_exit.i, %invoke_cont.44.i, %invoke_cont.43.i, %invoke_cont.42.i, %invoke_cont.41.i, %invoke_cont.40.i, %invoke_cont.39.i, %invoke_cont.38.i, %invoke_cont.37.i, %then.2.i, %invoke_cont.35.i, %invoke_cont.34.i, %then.1.i, %endif.0.i, %invoke_cont.9.i, %invoke_cont.8.i, %invoke_cont.7.i, %invoke_cont.i.i, %then.0.i, %invoke_cont.4.i, %invoke_cont.3.i, %invoke_cont.2.i, %invoke_cont.1.i, %endif.0.i.i, %tmp.7.i.noexc.i, %invoke_cont.0.i, %entry
118 ret void
119
120 invoke_cont.0.i: ; preds = %entry
121 %tmp.7.i1.i = invoke %"struct.llvm::TargetFrameInfo"* null( %"struct.llvm::TargetMachine"* null )
122 to label %tmp.7.i.noexc.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetFrameInfo"*> [#uses=2]
123
124 tmp.7.i.noexc.i: ; preds = %invoke_cont.0.i
125 %tmp.17.i2.i = invoke i32 null( %"struct.llvm::TargetFrameInfo"* %tmp.7.i1.i )
126 to label %endif.0.i.i unwind label %invoke_catch.0.i ; [#uses=0]
127
128 endif.0.i.i: ; preds = %tmp.7.i.noexc.i
129 %tmp.38.i4.i = invoke i32 null( %"struct.llvm::TargetFrameInfo"* %tmp.7.i1.i )
130 to label %tmp.38.i.noexc.i unwind label %invoke_catch.0.i ; [#uses=0]
131
132 tmp.38.i.noexc.i: ; preds = %endif.0.i.i
133 br i1 false, label %invoke_cont.1.i, label %then.1.i.i
134
135 then.1.i.i: ; preds = %tmp.38.i.noexc.i
136 ret void
137
138 invoke_cont.1.i: ; preds = %tmp.38.i.noexc.i
139 %tmp.21.i = invoke %"struct.llvm::TargetRegInfo"* null( %"struct.llvm::TargetMachine"* null )
140 to label %invoke_cont.2.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetRegInfo"*> [#uses=1]
141
142 invoke_cont.2.i: ; preds = %invoke_cont.1.i
143 %tmp.28.i = invoke i32 null( %"struct.llvm::TargetRegInfo"* %tmp.21.i )
144 to label %invoke_cont.3.i unwind label %invoke_catch.0.i ; [#uses=0]
145
146 invoke_cont.3.i: ; preds = %invoke_cont.2.i
147 %tmp.36.i = invoke %"struct.llvm::TargetInstrInfo"* null( %"struct.llvm::TargetMachine"* null )
148 to label %invoke_cont.4.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetInstrInfo"*> [#uses=1]
149
150 invoke_cont.4.i: ; preds = %invoke_cont.3.i
151 %tmp.43.i = invoke i1 null( %"struct.llvm::TargetInstrInfo"* %tmp.36.i, i16 383, i64 0 )
152 to label %invoke_cont.5.i unwind label %invoke_catch.0.i ; [#uses=1]
153
154 invoke_cont.5.i: ; preds = %invoke_cont.4.i
155 br i1 %tmp.43.i, label %then.0.i, label %else.i
156
157 then.0.i: ; preds = %invoke_cont.5.i
158 invoke void @_Znwj( )
159 to label %tmp.0.i.noexc.i unwind label %invoke_catch.0.i
160
161 tmp.0.i.noexc.i: ; preds = %then.0.i
162 invoke void @_ZN4llvm12MachineInstrC1Esjbb( )
163 to label %invoke_cont.i.i unwind label %cond_true.i.i
164
165 cond_true.i.i: ; preds = %tmp.0.i.noexc.i
166 ret void
167
168 invoke_cont.i.i: ; preds = %tmp.0.i.noexc.i
169 invoke void @_ZNK4llvm19MachineInstrBuilder7addMRegEiNS_14MachineOperand7UseTypeE( )
170 to label %invoke_cont.7.i unwind label %invoke_catch.0.i
171
172 invoke_cont.7.i: ; preds = %invoke_cont.i.i
173 invoke void @_ZNK4llvm19MachineInstrBuilder7addSImmEi( )
174 to label %invoke_cont.8.i unwind label %invoke_catch.0.i
175
176 invoke_cont.8.i: ; preds = %invoke_cont.7.i
177 invoke void @_ZNK4llvm19MachineInstrBuilder7addMRegEiNS_14MachineOperand7UseTypeE( )
178 to label %invoke_cont.9.i unwind label %invoke_catch.0.i
179
180 invoke_cont.9.i: ; preds = %invoke_cont.8.i
181 invoke void @_ZNSt6vectorIPN4llvm12MachineInstrESaIS2_EE9push_backERKS2_( )
182 to label %endif.0.i unwind label %invoke_catch.0.i
183
184 else.i: ; preds = %invoke_cont.5.i
185 ret void
186
187 endif.0.i: ; preds = %invoke_cont.9.i
188 invoke void @_ZNK4llvm8Function15getFunctionTypeEv( )
189 to label %invoke_cont.33.i unwind label %invoke_catch.0.i
190
191 invoke_cont.33.i: ; preds = %endif.0.i
192 br i1 false, label %then.1.i, label %endif.1.i
193
194 then.1.i: ; preds = %invoke_cont.33.i
195 invoke void @_ZNK4llvm8Function15getFunctionTypeEv( )
196 to label %invoke_cont.34.i unwind label %invoke_catch.0.i
197
198 invoke_cont.34.i: ; preds = %then.1.i
199 %tmp.121.i = invoke %"struct.llvm::TargetRegInfo"* null( %"struct.llvm::TargetMachine"* null )
200 to label %invoke_cont.35.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetRegInfo"*> [#uses=1]
201
202 invoke_cont.35.i: ; preds = %invoke_cont.34.i
203 %tmp.128.i = invoke i32 null( %"struct.llvm::TargetRegInfo"* %tmp.121.i )
204 to label %invoke_cont.36.i unwind label %invoke_catch.0.i ; [#uses=0]
205
206 invoke_cont.36.i: ; preds = %invoke_cont.35.i
207 br i1 false, label %then.2.i, label %endif.1.i
208
209 then.2.i: ; preds = %invoke_cont.36.i
210 %tmp.140.i = invoke %"struct.llvm::TargetRegInfo"* null( %"struct.llvm::TargetMachine"* null )
211 to label %invoke_cont.37.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetRegInfo"*> [#uses=0]
212
213 invoke_cont.37.i: ; preds = %then.2.i
214 %tmp.148.i = invoke %"struct.llvm::TargetRegInfo"* null( %"struct.llvm::TargetMachine"* null )
215 to label %invoke_cont.38.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetRegInfo"*> [#uses=1]
216
217 invoke_cont.38.i: ; preds = %invoke_cont.37.i
218 %tmp.155.i = invoke i32 null( %"struct.llvm::TargetRegInfo"* %tmp.148.i, %"struct.llvm::Type"* null, i1 false )
219 to label %invoke_cont.39.i unwind label %invoke_catch.0.i ; [#uses=0]
220
221 invoke_cont.39.i: ; preds = %invoke_cont.38.i
222 %tmp.163.i = invoke %"struct.llvm::TargetFrameInfo"* null( %"struct.llvm::TargetMachine"* null )
223 to label %invoke_cont.40.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetFrameInfo"*> [#uses=1]
224
225 invoke_cont.40.i: ; preds = %invoke_cont.39.i
226 %tmp.170.i = invoke i32 null( %"struct.llvm::TargetFrameInfo"* %tmp.163.i )
227 to label %invoke_cont.41.i unwind label %invoke_catch.0.i ; [#uses=0]
228
229 invoke_cont.41.i: ; preds = %invoke_cont.40.i
230 %tmp.177.i = invoke %"struct.llvm::TargetFrameInfo"* null( %"struct.llvm::TargetMachine"* null )
231 to label %invoke_cont.42.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetFrameInfo"*> [#uses=1]
232
233 invoke_cont.42.i: ; preds = %invoke_cont.41.i
234 %tmp.184.i = invoke i32 null( %"struct.llvm::TargetFrameInfo"* %tmp.177.i )
235 to label %invoke_cont.43.i unwind label %invoke_catch.0.i ; [#uses=1]
236
237 invoke_cont.43.i: ; preds = %invoke_cont.42.i
238 %tmp.191.i = invoke %"struct.llvm::TargetFrameInfo"* null( %"struct.llvm::TargetMachine"* null )
239 to label %invoke_cont.44.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetFrameInfo"*> [#uses=1]
240
241 invoke_cont.44.i: ; preds = %invoke_cont.43.i
242 %tmp.198.i = invoke i32 null( %"struct.llvm::TargetFrameInfo"* %tmp.191.i, %"struct.llvm::MachineFunction"* %F, i1* null )
243 to label %invoke_cont.45.i unwind label %invoke_catch.0.i ; [#uses=0]
244
245 invoke_cont.45.i: ; preds = %invoke_cont.44.i
246 br i1 false, label %no_exit.i, label %endif.1.i
247
248 no_exit.i: ; preds = %invoke_cont.50.i, %invoke_cont.45.i
249 %nextArgOffset.0.i.1 = phi i32 [ %tmp.221.i, %invoke_cont.50.i ], [ 0, %invoke_cont.45.i ] ; [#uses=1]
250 invoke void @_Znwj( )
251 to label %tmp.0.i.noexc55.i unwind label %invoke_catch.0.i
252
253 tmp.0.i.noexc55.i: ; preds = %no_exit.i
254 invoke void @_ZN4llvm12MachineInstrC1Esjbb( )
255 to label %invoke_cont.i53.i unwind label %cond_true.i52.i
256
257 cond_true.i52.i: ; preds = %tmp.0.i.noexc55.i
258 ret void
259
260 invoke_cont.i53.i: ; preds = %tmp.0.i.noexc55.i
261 invoke void @_ZNK4llvm19MachineInstrBuilder7addMRegEiNS_14MachineOperand7UseTypeE( )
262 to label %invoke_cont.47.i unwind label %invoke_catch.0.i
263
264 invoke_cont.47.i: ; preds = %invoke_cont.i53.i
265 invoke void @_ZNK4llvm19MachineInstrBuilder7addMRegEiNS_14MachineOperand7UseTypeE( )
266 to label %invoke_cont.48.i unwind label %invoke_catch.0.i
267
268 invoke_cont.48.i: ; preds = %invoke_cont.47.i
269 invoke void @_ZNK4llvm19MachineInstrBuilder7addSImmEi( )
270 to label %invoke_cont.49.i unwind label %invoke_catch.0.i
271
272 invoke_cont.49.i: ; preds = %invoke_cont.48.i
273 invoke void @_ZNSt6vectorIPN4llvm12MachineInstrESaIS2_EE9push_backERKS2_( )
274 to label %invoke_cont.50.i unwind label %invoke_catch.0.i
275
276 invoke_cont.50.i: ; preds = %invoke_cont.49.i
277 %tmp.221.i = add i32 %nextArgOffset.0.i.1, %tmp.184.i ; [#uses=1]
278 br i1 false, label %no_exit.i, label %endif.1.i
279
280 endif.1.i: ; preds = %invoke_cont.50.i, %invoke_cont.45.i, %invoke_cont.36.i, %invoke_cont.33.i
281 ret void
282 }
+0
-283
test/Transforms/IndVarsSimplify/2004-04-05-InvokeCastCrash.llx less more
None ; RUN: llvm-as < %s | opt -indvars -disable-output
1 ; ModuleID = '2004-04-05-InvokeCastCrash.llx'
2 %struct.__false_type = type { i8 }
3 %"struct.__gnu_cxx::_Hashtable_node" = type { %"struct.__gnu_cxx::_Hashtable_node"*, %"struct.llvm::Constant"* }
4 %"struct.__gnu_cxx::_Hashtable_node >" = type { %"struct.__gnu_cxx::_Hashtable_node >"*, %"struct.std::pair" }
5 %"struct.__gnu_cxx::hash_map,std::equal_to,std::allocator >" = type { %"struct.__gnu_cxx::hashtable,const llvm::Value*,__gnu_cxx::hash,std::_Select1st >,std::equal_to,std::allocator >" }
6 %"struct.__gnu_cxx::hash_set,std::equal_to,std::allocator >" = type { %"struct.__gnu_cxx::hashtable,std::_Identity,std::equal_to,std::allocator >" }
7 %"struct.__gnu_cxx::hashtable,std::_Identity,std::equal_to,std::allocator >" = type { %struct.__false_type, %struct.__false_type, %struct.__false_type, %struct.__false_type, %"struct.std::vector<__gnu_cxx::_Hashtable_node*,std::allocator >", i32 }
8 %"struct.__gnu_cxx::hashtable,const llvm::Value*,__gnu_cxx::hash,std::_Select1st >,std::equal_to,std::allocator >" = type { %struct.__false_type, %struct.__false_type, %struct.__false_type, %struct.__false_type, %"struct.std::vector<__gnu_cxx::_Hashtable_node >*,std::allocator >", i32 }
9 %"struct.llvm::AbstractTypeUser" = type { i32 (...)** }
10 %"struct.llvm::Annotable" = type { i32 (...)**, %"struct.llvm::Annotation"* }
11 %"struct.llvm::Annotation" = type { i32 (...)**, %"struct.llvm::AnnotationID", %"struct.llvm::Annotation"* }
12 %"struct.llvm::AnnotationID" = type { i32 }
13 %"struct.llvm::Argument" = type { %"struct.llvm::Value", %"struct.llvm::Function"*, %"struct.llvm::Argument"*, %"struct.llvm::Argument"* }
14 %"struct.llvm::BasicBlock" = type { %"struct.llvm::Value", %"struct.llvm::iplist >", %"struct.llvm::BasicBlock"*, %"struct.llvm::BasicBlock"* }
15 %"struct.llvm::Constant" = type opaque
16 %"struct.llvm::DerivedType" = type { %"struct.llvm::Type", %"struct.llvm::AbstractTypeUser", %"struct.std::vector >" }
17 %"struct.llvm::Function" = type { %"struct.llvm::GlobalValue", %"struct.llvm::Annotable", %"struct.llvm::iplist >", %"struct.llvm::iplist >", %"struct.llvm::SymbolTable"*, %"struct.llvm::Function"*, %"struct.llvm::Function"* }
18 %"struct.llvm::FunctionPass" = type { %"struct.llvm::Pass" }
19 %"struct.llvm::FunctionType" = type { %"struct.llvm::DerivedType", i1 }
20 %"struct.llvm::GlobalValue" = type { %"struct.llvm::User", i32, %"struct.llvm::Module"* }
21 %"struct.llvm::Instruction" = type { %"struct.llvm::User", %"struct.llvm::Annotable", %"struct.llvm::BasicBlock"*, %"struct.llvm::Instruction"*, %"struct.llvm::Instruction"*, i32 }
22 %"struct.llvm::IntrinsicLowering" = type opaque
23 %"struct.llvm::MachineBasicBlock" = type { %"struct.llvm::ilist", %"struct.llvm::MachineBasicBlock"*, %"struct.llvm::MachineBasicBlock"*, %"struct.llvm::BasicBlock"* }
24 %"struct.llvm::MachineConstantPool" = type opaque
25 %"struct.llvm::MachineFrameInfo" = type opaque
26 %"struct.llvm::MachineFunction" = type { %"struct.llvm::Annotation", %"struct.llvm::Function"*, %"struct.llvm::TargetMachine"*, %"struct.llvm::iplist >", %"struct.llvm::SSARegMap"*, %"struct.llvm::MachineFunctionInfo"*, %"struct.llvm::MachineFrameInfo"*, %"struct.llvm::MachineConstantPool"* }
27 %"struct.llvm::MachineFunctionInfo" = type { %"struct.__gnu_cxx::hash_set,std::equal_to,std::allocator >", %"struct.__gnu_cxx::hash_map,std::equal_to,std::allocator >", i32, i32, i32, i32, i32, i32, i32, i1, i1, i1, %"struct.llvm::MachineFunction"* }
28 %"struct.llvm::MachineFunctionPass" = type { %"struct.llvm::FunctionPass" }
29 %"struct.llvm::MachineInstr" = type { i16, i8, %"struct.std::vector >", %"struct.llvm::MachineInstr"*, %"struct.llvm::MachineInstr"*, %"struct.llvm::MachineBasicBlock"* }
30 %"struct.llvm::MachineInstrBuilder" = type { %"struct.llvm::MachineInstr"* }
31 %"struct.llvm::MachineOperand" = type { %"union.llvm::MachineOperand::._65", i32, i32 }
32 %"struct.llvm::Module" = type opaque
33 %"struct.llvm::PATypeHandle" = type { %"struct.llvm::Type"*, %"struct.llvm::AbstractTypeUser"* }
34 %"struct.llvm::PATypeHolder" = type { %"struct.llvm::Type"* }
35 %"struct.llvm::Pass" = type { i32 (...)**, %"struct.llvm::AbstractTypeUser"*, %"struct.llvm::PassInfo"*, %"struct.std::vector,std::allocator > >" }
36 %"struct.llvm::PassInfo" = type { i8*, i8*, %"struct.std::type_info"*, i8, %"struct.std::vector >", %"struct.llvm::Pass"* ()*, %"struct.llvm::Pass"* (%"struct.llvm::TargetMachine"*)* }
37 %"struct.llvm::SSARegMap" = type opaque
38 %"struct.llvm::SymbolTable" = type opaque
39 %"struct.llvm::SymbolTableListTraits >" = type { %"struct.llvm::Function"*, %"struct.llvm::Function"* }
40 %"struct.llvm::SymbolTableListTraits >" = type { %"struct.llvm::Function"*, %"struct.llvm::BasicBlock"* }
41 %"struct.llvm::TargetData" = type { %"struct.llvm::FunctionPass", i1, i8, i8, i8, i8, i8, i8, i8, i8 }
42 %"struct.llvm::TargetFrameInfo" = type { i32 (...)**, i32, i32, i32 }
43 %"struct.llvm::TargetInstrDescriptor" = type { i8*, i32, i32, i32, i1, i32, i32, i32, i32, i32, i32*, i32* }
44 %"struct.llvm::TargetInstrInfo" = type { i32 (...)**, %"struct.llvm::TargetInstrDescriptor"*, i32, i32 }
45 %"struct.llvm::TargetMachine" = type { i32 (...)**, %"struct.std::basic_string,std::allocator >", %"struct.llvm::TargetData", %"struct.llvm::IntrinsicLowering"* }
46 %"struct.llvm::TargetRegClassInfo" = type { i32 (...)**, i32, i32, i32 }
47 %"struct.llvm::TargetRegInfo" = type { i32 (...)**, %"struct.std::vector >", %"struct.llvm::TargetMachine"* }
48 %"struct.llvm::Type" = type { %"struct.llvm::Value", i32, i32, i1, i32, %"struct.llvm::Type"*, %"struct.std::vector >" }
49 %"struct.llvm::Use" = type { %"struct.llvm::Value"*, %"struct.llvm::User"*, %"struct.llvm::Use"*, %"struct.llvm::Use"* }
50 %"struct.llvm::User" = type { %"struct.llvm::Value", %"struct.std::vector >" }
51 %"struct.llvm::Value" = type { i32 (...)**, %"struct.llvm::iplist >", %"struct.std::basic_string,std::allocator >", %"struct.llvm::PATypeHolder", i32 }
52 %"struct.llvm::_GLOBAL__N_::InsertPrologEpilogCode" = type { %"struct.llvm::MachineFunctionPass" }
53 %"struct.llvm::ilist" = type { %"struct.llvm::iplist >" }
54 %"struct.llvm::ilist_iterator" = type { %"struct.llvm::MachineBasicBlock"* }
55 %"struct.llvm::ilist_traits" = type { %"struct.llvm::SymbolTableListTraits >" }
56 %"struct.llvm::ilist_traits" = type { %"struct.llvm::SymbolTableListTraits >" }
57 %"struct.llvm::iplist >" = type { %"struct.llvm::ilist_traits", %"struct.llvm::Argument"*, %"struct.llvm::Argument"* }
58 %"struct.llvm::iplist >" = type { %"struct.llvm::ilist_traits", %"struct.llvm::BasicBlock"*, %"struct.llvm::BasicBlock"* }
59 %"struct.llvm::iplist >" = type { %"struct.llvm::ilist_traits", %"struct.llvm::Instruction"*, %"struct.llvm::Instruction"* }
60 %"struct.llvm::iplist >" = type { %"struct.llvm::MachineBasicBlock"*, %"struct.llvm::MachineBasicBlock"* }
61 %"struct.llvm::iplist >" = type { %"struct.llvm::ilist_iterator", %"struct.llvm::MachineInstr"*, %"struct.llvm::MachineInstr"* }
62 %"struct.llvm::iplist >" = type { %"struct.llvm::Use"*, %"struct.llvm::Use"* }
63 %"struct.std::_Vector_alloc_base<__gnu_cxx::_Hashtable_node*,std::allocator, true>" = type { %"struct.__gnu_cxx::_Hashtable_node"**, %"struct.__gnu_cxx::_Hashtable_node"**, %"struct.__gnu_cxx::_Hashtable_node"** }
64 %"struct.std::_Vector_alloc_base<__gnu_cxx::_Hashtable_node >*,std::allocator, true>" = type { %"struct.__gnu_cxx::_Hashtable_node >"**, %"struct.__gnu_cxx::_Hashtable_node >"**, %"struct.__gnu_cxx::_Hashtable_node >"** }
65 %"struct.std::_Vector_alloc_base, true>" = type { %"struct.llvm::PassInfo"**, %"struct.llvm::PassInfo"**, %"struct.llvm::PassInfo"** }
66 %"struct.std::_Vector_alloc_base, true>" = type { %"struct.llvm::TargetFrameInfo"**, %"struct.llvm::TargetFrameInfo"**, %"struct.llvm::TargetFrameInfo"** }
67 %"struct.std::_Vector_alloc_base, true>" = type { %"struct.llvm::AbstractTypeUser"**, %"struct.llvm::AbstractTypeUser"**, %"struct.llvm::AbstractTypeUser"** }
68 %"struct.std::_Vector_alloc_base, true>" = type { %"struct.llvm::MachineInstr"**, %"struct.llvm::MachineInstr"**, %"struct.llvm::MachineInstr"** }
69 %"struct.std::_Vector_alloc_base, true>" = type { %"struct.llvm::MachineOperand"*, %"struct.llvm::MachineOperand"*, %"struct.llvm::MachineOperand"* }
70 %"struct.std::_Vector_alloc_base, true>" = type { %"struct.llvm::PATypeHandle"*, %"struct.llvm::PATypeHandle"*, %"struct.llvm::PATypeHandle"* }
71 %"struct.std::_Vector_alloc_base, true>" = type { %"struct.llvm::Use"*, %"struct.llvm::Use"*, %"struct.llvm::Use"* }
72 %"struct.std::_Vector_alloc_base,std::allocator >, true>" = type { %"struct.std::pair"*, %"struct.std::pair"*, %"struct.std::pair"* }
73 %"struct.std::_Vector_base<__gnu_cxx::_Hashtable_node*,std::allocator >" = type { %"struct.std::_Vector_alloc_base<__gnu_cxx::_Hashtable_node*,std::allocator, true>" }
74 %"struct.std::_Vector_base<__gnu_cxx::_Hashtable_node >*,std::allocator >" = type { %"struct.std::_Vector_alloc_base<__gnu_cxx::_Hashtable_node >*,std::allocator, true>" }
75 %"struct.std::_Vector_base >" = type { %"struct.std::_Vector_alloc_base, true>" }
76 %"struct.std::_Vector_base >" = type { %"struct.std::_Vector_alloc_base, true>" }
77 %"struct.std::_Vector_base >" = type { %"struct.std::_Vector_alloc_base, true>" }
78 %"struct.std::_Vector_base >" = type { %"struct.std::_Vector_alloc_base, true>" }
79 %"struct.std::_Vector_base >" = type { %"struct.std::_Vector_alloc_base, true>" }
80 %"struct.std::_Vector_base >" = type { %"struct.std::_Vector_alloc_base, true>" }
81 %"struct.std::_Vector_base >" = type { %"struct.std::_Vector_alloc_base, true>" }
82 %"struct.std::_Vector_base,std::allocator > >" = type { %"struct.std::_Vector_alloc_base,std::allocator >, true>" }
83 %"struct.std::basic_string,std::allocator >" = type { %"struct.std::basic_string,std::allocator >::_Alloc_hider" }
84 %"struct.std::basic_string,std::allocator >::_Alloc_hider" = type { i8* }
85 %"struct.std::pair" = type { %"struct.llvm::PassInfo"*, %"struct.llvm::Pass"* }
86 %"struct.std::pair" = type { %"struct.llvm::Value"*, i32 }
87 %"struct.std::type_info" = type { i32 (...)**, i8* }
88 %"struct.std::vector<__gnu_cxx::_Hashtable_node*,std::allocator >" = type { %"struct.std::_Vector_base<__gnu_cxx::_Hashtable_node*,std::allocator >" }
89 %"struct.std::vector<__gnu_cxx::_Hashtable_node >*,std::allocator >" = type { %"struct.std::_Vector_base<__gnu_cxx::_Hashtable_node >*,std::allocator >" }
90 %"struct.std::vector >" = type { %"struct.std::_Vector_base >" }
91 %"struct.std::vector >" = type { %"struct.std::_Vector_base >" }
92 %"struct.std::vector >" = type { %"struct.std::_Vector_base >" }
93 %"struct.std::vector >" = type { %"struct.std::_Vector_base >" }
94 %"struct.std::vector >" = type { %"struct.std::_Vector_base >" }
95 %"struct.std::vector >" = type { %"struct.std::_Vector_base >" }
96 %"struct.std::vector >" = type { %"struct.std::_Vector_base >" }
97 %"struct.std::vector,std::allocator > >" = type { %"struct.std::_Vector_base,std::allocator > >" }
98 %"union.llvm::MachineOperand::._65" = type { %"struct.std::basic_string,std::allocator >"* }
99
100 declare void @_Znwj()
101
102 declare void @_ZN4llvm12MachineInstrC1Esjbb()
103
104 declare void @_ZNSt6vectorIPN4llvm12MachineInstrESaIS2_EE9push_backERKS2_()
105
106 declare void @_ZNK4llvm8Function15getFunctionTypeEv()
107
108 declare void @_ZNK4llvm19MachineInstrBuilder7addMRegEiNS_14MachineOperand7UseTypeE()
109
110 declare void @_ZNK4llvm19MachineInstrBuilder7addSImmEi()
111
112 define void @_ZN4llvm11_GLOBAL__N_22InsertPrologEpilogCode20runOnMachineFunctionERNS_15MachineFunctionE(%"struct.llvm::MachineFunction"* %F) {
113 entry:
114 %tmp.8.i = invoke %"struct.llvm::TargetFrameInfo"* null( %"struct.llvm::TargetMachine"* null )
115 to label %invoke_cont.0.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetFrameInfo"*> [#uses=0]
116
117 invoke_catch.0.i: ; preds = %invoke_cont.49.i, %invoke_cont.48.i, %invoke_cont.47.i, %invoke_cont.i53.i, %no_exit.i, %invoke_cont.44.i, %invoke_cont.43.i, %invoke_cont.42.i, %invoke_cont.41.i, %invoke_cont.40.i, %invoke_cont.39.i, %invoke_cont.38.i, %invoke_cont.37.i, %then.2.i, %invoke_cont.35.i, %invoke_cont.34.i, %then.1.i, %endif.0.i, %invoke_cont.9.i, %invoke_cont.8.i, %invoke_cont.7.i, %invoke_cont.i.i, %then.0.i, %invoke_cont.4.i, %invoke_cont.3.i, %invoke_cont.2.i, %invoke_cont.1.i, %endif.0.i.i, %tmp.7.i.noexc.i, %invoke_cont.0.i, %entry
118 ret void
119
120 invoke_cont.0.i: ; preds = %entry
121 %tmp.7.i1.i = invoke %"struct.llvm::TargetFrameInfo"* null( %"struct.llvm::TargetMachine"* null )
122 to label %tmp.7.i.noexc.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetFrameInfo"*> [#uses=2]
123
124 tmp.7.i.noexc.i: ; preds = %invoke_cont.0.i
125 %tmp.17.i2.i = invoke i32 null( %"struct.llvm::TargetFrameInfo"* %tmp.7.i1.i )
126 to label %endif.0.i.i unwind label %invoke_catch.0.i ; [#uses=0]
127
128 endif.0.i.i: ; preds = %tmp.7.i.noexc.i
129 %tmp.38.i4.i = invoke i32 null( %"struct.llvm::TargetFrameInfo"* %tmp.7.i1.i )
130 to label %tmp.38.i.noexc.i unwind label %invoke_catch.0.i ; [#uses=0]
131
132 tmp.38.i.noexc.i: ; preds = %endif.0.i.i
133 br i1 false, label %invoke_cont.1.i, label %then.1.i.i
134
135 then.1.i.i: ; preds = %tmp.38.i.noexc.i
136 ret void
137
138 invoke_cont.1.i: ; preds = %tmp.38.i.noexc.i
139 %tmp.21.i = invoke %"struct.llvm::TargetRegInfo"* null( %"struct.llvm::TargetMachine"* null )
140 to label %invoke_cont.2.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetRegInfo"*> [#uses=1]
141
142 invoke_cont.2.i: ; preds = %invoke_cont.1.i
143 %tmp.28.i = invoke i32 null( %"struct.llvm::TargetRegInfo"* %tmp.21.i )
144 to label %invoke_cont.3.i unwind label %invoke_catch.0.i ; [#uses=0]
145
146 invoke_cont.3.i: ; preds = %invoke_cont.2.i
147 %tmp.36.i = invoke %"struct.llvm::TargetInstrInfo"* null( %"struct.llvm::TargetMachine"* null )
148 to label %invoke_cont.4.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetInstrInfo"*> [#uses=1]
149
150 invoke_cont.4.i: ; preds = %invoke_cont.3.i
151 %tmp.43.i = invoke i1 null( %"struct.llvm::TargetInstrInfo"* %tmp.36.i, i16 383, i64 0 )
152 to label %invoke_cont.5.i unwind label %invoke_catch.0.i ; [#uses=1]
153
154 invoke_cont.5.i: ; preds = %invoke_cont.4.i
155 br i1 %tmp.43.i, label %then.0.i, label %else.i
156
157 then.0.i: ; preds = %invoke_cont.5.i
158 invoke void @_Znwj( )
159 to label %tmp.0.i.noexc.i unwind label %invoke_catch.0.i
160
161 tmp.0.i.noexc.i: ; preds = %then.0.i
162 invoke void @_ZN4llvm12MachineInstrC1Esjbb( )
163 to label %invoke_cont.i.i unwind label %cond_true.i.i
164
165 cond_true.i.i: ; preds = %tmp.0.i.noexc.i
166 ret void
167
168 invoke_cont.i.i: ; preds = %tmp.0.i.noexc.i
169 invoke void @_ZNK4llvm19MachineInstrBuilder7addMRegEiNS_14MachineOperand7UseTypeE( )
170 to label %invoke_cont.7.i unwind label %invoke_catch.0.i
171
172 invoke_cont.7.i: ; preds = %invoke_cont.i.i
173 invoke void @_ZNK4llvm19MachineInstrBuilder7addSImmEi( )
174 to label %invoke_cont.8.i unwind label %invoke_catch.0.i
175
176 invoke_cont.8.i: ; preds = %invoke_cont.7.i
177 invoke void @_ZNK4llvm19MachineInstrBuilder7addMRegEiNS_14MachineOperand7UseTypeE( )
178 to label %invoke_cont.9.i unwind label %invoke_catch.0.i
179
180 invoke_cont.9.i: ; preds = %invoke_cont.8.i
181 invoke void @_ZNSt6vectorIPN4llvm12MachineInstrESaIS2_EE9push_backERKS2_( )
182 to label %endif.0.i unwind label %invoke_catch.0.i
183
184 else.i: ; preds = %invoke_cont.5.i
185 ret void
186
187 endif.0.i: ; preds = %invoke_cont.9.i
188 invoke void @_ZNK4llvm8Function15getFunctionTypeEv( )
189 to label %invoke_cont.33.i unwind label %invoke_catch.0.i
190
191 invoke_cont.33.i: ; preds = %endif.0.i
192 br i1 false, label %then.1.i, label %endif.1.i
193
194 then.1.i: ; preds = %invoke_cont.33.i
195 invoke void @_ZNK4llvm8Function15getFunctionTypeEv( )
196 to label %invoke_cont.34.i unwind label %invoke_catch.0.i
197
198 invoke_cont.34.i: ; preds = %then.1.i
199 %tmp.121.i = invoke %"struct.llvm::TargetRegInfo"* null( %"struct.llvm::TargetMachine"* null )
200 to label %invoke_cont.35.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetRegInfo"*> [#uses=1]
201
202 invoke_cont.35.i: ; preds = %invoke_cont.34.i
203 %tmp.128.i = invoke i32 null( %"struct.llvm::TargetRegInfo"* %tmp.121.i )
204 to label %invoke_cont.36.i unwind label %invoke_catch.0.i ; [#uses=0]
205
206 invoke_cont.36.i: ; preds = %invoke_cont.35.i
207 br i1 false, label %then.2.i, label %endif.1.i
208
209 then.2.i: ; preds = %invoke_cont.36.i
210 %tmp.140.i = invoke %"struct.llvm::TargetRegInfo"* null( %"struct.llvm::TargetMachine"* null )
211 to label %invoke_cont.37.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetRegInfo"*> [#uses=0]
212
213 invoke_cont.37.i: ; preds = %then.2.i
214 %tmp.148.i = invoke %"struct.llvm::TargetRegInfo"* null( %"struct.llvm::TargetMachine"* null )
215 to label %invoke_cont.38.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetRegInfo"*> [#uses=1]
216
217 invoke_cont.38.i: ; preds = %invoke_cont.37.i
218 %tmp.155.i = invoke i32 null( %"struct.llvm::TargetRegInfo"* %tmp.148.i, %"struct.llvm::Type"* null, i1 false )
219 to label %invoke_cont.39.i unwind label %invoke_catch.0.i ; [#uses=0]
220
221 invoke_cont.39.i: ; preds = %invoke_cont.38.i
222 %tmp.163.i = invoke %"struct.llvm::TargetFrameInfo"* null( %"struct.llvm::TargetMachine"* null )
223 to label %invoke_cont.40.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetFrameInfo"*> [#uses=1]
224
225 invoke_cont.40.i: ; preds = %invoke_cont.39.i
226 %tmp.170.i = invoke i32 null( %"struct.llvm::TargetFrameInfo"* %tmp.163.i )
227 to label %invoke_cont.41.i unwind label %invoke_catch.0.i ; [#uses=0]
228
229 invoke_cont.41.i: ; preds = %invoke_cont.40.i
230 %tmp.177.i = invoke %"struct.llvm::TargetFrameInfo"* null( %"struct.llvm::TargetMachine"* null )
231 to label %invoke_cont.42.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetFrameInfo"*> [#uses=1]
232
233 invoke_cont.42.i: ; preds = %invoke_cont.41.i
234 %tmp.184.i = invoke i32 null( %"struct.llvm::TargetFrameInfo"* %tmp.177.i )
235 to label %invoke_cont.43.i unwind label %invoke_catch.0.i ; [#uses=1]
236
237 invoke_cont.43.i: ; preds = %invoke_cont.42.i
238 %tmp.191.i = invoke %"struct.llvm::TargetFrameInfo"* null( %"struct.llvm::TargetMachine"* null )
239 to label %invoke_cont.44.i unwind label %invoke_catch.0.i ; <%"struct.llvm::TargetFrameInfo"*> [#uses=1]
240
241 invoke_cont.44.i: ; preds = %invoke_cont.43.i
242 %tmp.198.i = invoke i32 null( %"struct.llvm::TargetFrameInfo"* %tmp.191.i, %"struct.llvm::MachineFunction"* %F, i1* null )
243 to label %invoke_cont.45.i unwind label %invoke_catch.0.i ; [#uses=0]
244
245 invoke_cont.45.i: ; preds = %invoke_cont.44.i
246 br i1 false, label %no_exit.i, label %endif.1.i
247
248 no_exit.i: ; preds = %invoke_cont.50.i, %invoke_cont.45.i
249 %nextArgOffset.0.i.1 = phi i32 [ %tmp.221.i, %invoke_cont.50.i ], [ 0, %invoke_cont.45.i ] ; [#uses=1]
250 invoke void @_Znwj( )
251 to label %tmp.0.i.noexc55.i unwind label %invoke_catch.0.i
252
253 tmp.0.i.noexc55.i: ; preds = %no_exit.i
254 invoke void @_ZN4llvm12MachineInstrC1Esjbb( )
255 to label %invoke_cont.i53.i unwind label %cond_true.i52.i
256
257 cond_true.i52.i: ; preds = %tmp.0.i.noexc55.i
258 ret void
259
260 invoke_cont.i53.i: ; preds = %tmp.0.i.noexc55.i
261 invoke void @_ZNK4llvm19MachineInstrBuilder7addMRegEiNS_14MachineOperand7UseTypeE( )
262 to label %invoke_cont.47.i unwind label %invoke_catch.0.i
263
264 invoke_cont.47.i: ; preds = %invoke_cont.i53.i
265 invoke void @_ZNK4llvm19MachineInstrBuilder7addMRegEiNS_14MachineOperand7UseTypeE( )
266 to label %invoke_cont.48.i unwind label %invoke_catch.0.i
267
268 invoke_cont.48.i: ; preds = %invoke_cont.47.i
269 invoke void @_ZNK4llvm19MachineInstrBuilder7addSImmEi( )
270 to label %invoke_cont.49.i unwind label %invoke_catch.0.i
271
272 invoke_cont.49.i: ; preds = %invoke_cont.48.i
273 invoke void @_ZNSt6vectorIPN4llvm12MachineInstrESaIS2_EE9push_backERKS2_( )
274 to label %invoke_cont.50.i unwind label %invoke_catch.0.i
275
276 invoke_cont.50.i: ; preds = %invoke_cont.49.i
277 %tmp.221.i = add i32 %nextArgOffset.0.i.1, %tmp.184.i ; [#uses=1]
278 br i1 false, label %no_exit.i, label %endif.1.i
279
280 endif.1.i: ; preds = %invoke_cont.50.i, %invoke_cont.45.i, %invoke_cont.36.i, %invoke_cont.33.i
281 ret void
282 }
0 ; RUN: llvm-as < %s | opt -indvars -disable-output
1
2 define void @.outPlank_21() {
3 entry:
4 br i1 false, label %loopexit.0, label %no_exit.0
5
6 no_exit.0: ; preds = %entry
7 ret void
8
9 loopexit.0: ; preds = %entry
10 br i1 false, label %no_exit.1, label %loopexit.1
11
12 no_exit.1: ; preds = %loopexit.2, %loopexit.0
13 %i.0.0 = phi i32 [ %inc, %loopexit.2 ], [ 0, %loopexit.0 ] ; [#uses=1]
14 br i1 false, label %loopexit.2, label %no_exit.2
15
16 no_exit.2: ; preds = %no_exit.1
17 ret void
18
19 loopexit.2: ; preds = %no_exit.1
20 %inc = add i32 %i.0.0, 1 ; [#uses=1]
21 br i1 false, label %no_exit.1, label %loopexit.1
22
23 loopexit.1: ; preds = %loopexit.2, %loopexit.0
24 ret void
25 }
26
+0
-27
test/Transforms/IndVarsSimplify/2004-04-07-ScalarEvolutionCrash.llx less more
None ; RUN: llvm-as < %s | opt -indvars -disable-output
1
2 define void @.outPlank_21() {
3 entry:
4 br i1 false, label %loopexit.0, label %no_exit.0
5
6 no_exit.0: ; preds = %entry
7 ret void
8
9 loopexit.0: ; preds = %entry
10 br i1 false, label %no_exit.1, label %loopexit.1
11
12 no_exit.1: ; preds = %loopexit.2, %loopexit.0
13 %i.0.0 = phi i32 [ %inc, %loopexit.2 ], [ 0, %loopexit.0 ] ; [#uses=1]
14 br i1 false, label %loopexit.2, label %no_exit.2
15
16 no_exit.2: ; preds = %no_exit.1
17 ret void
18
19 loopexit.2: ; preds = %no_exit.1
20 %inc = add i32 %i.0.0, 1 ; [#uses=1]
21 br i1 false, label %no_exit.1, label %loopexit.1
22
23 loopexit.1: ; preds = %loopexit.2, %loopexit.0
24 ret void
25 }
26
0 ; Test that we can evaluate the exit values of various expression types. Since
1 ; these loops all have predictable exit values we can replace the use outside
2 ; of the loop with a closed-form computation, making the loop dead.
3 ;
4 ; RUN: llvm-as < %s | opt -indvars -adce -simplifycfg | \
5 ; RUN: llvm-dis | not grep br
6
7 define i32 @polynomial_constant() {
8 ;
9 br label %Loop
10
11 Loop: ; preds = %Loop, %0
12 %A1 = phi i32 [ 0, %0 ], [ %A2, %Loop ] ; [#uses=3]
13 %B1 = phi i32 [ 0, %0 ], [ %B2, %Loop ] ; [#uses=1]
14 %A2 = add i32 %A1, 1 ; [#uses=1]
15 %B2 = add i32 %B1, %A1 ; [#uses=2]
16 %C = icmp eq i32 %A1, 1000 ; [#uses=1]
17 br i1 %C, label %Out, label %Loop
18
19 Out: ; preds = %Loop
20 ret i32 %B2
21 }
22
23 define i32 @NSquare(i32 %N) {
24 ;
25 br label %Loop
26
27 Loop: ; preds = %Loop, %0
28 %X = phi i32 [ 0, %0 ], [ %X2, %Loop ] ; [#uses=4]
29 %X2 = add i32 %X, 1 ; [#uses=1]
30 %c = icmp eq i32 %X, %N ; [#uses=1]
31 br i1 %c, label %Out, label %Loop
32
33 Out: ; preds = %Loop
34 %Y = mul i32 %X, %X ; [#uses=1]
35 ret i32 %Y
36 }
37
38 define i32 @NSquareOver2(i32 %N) {
39 ;
40 br label %Loop
41
42 Loop: ; preds = %Loop, %0
43 %X = phi i32 [ 0, %0 ], [ %X2, %Loop ] ; [#uses=3]
44 %Y = phi i32 [ 15, %0 ], [ %Y2, %Loop ] ; [#uses=1]
45 %Y2 = add i32 %Y, %X ; [#uses=2]
46 %X2 = add i32 %X, 1 ; [#uses=1]
47 %c = icmp eq i32 %X, %N ; [#uses=1]
48 br i1 %c, label %Out, label %Loop
49
50 Out: ; preds = %Loop
51 ret i32 %Y2
52 }
53
54 define i32 @strength_reduced() {
55 ;
56 br label %Loop
57
58 Loop: ; preds = %Loop, %0
59 %A1 = phi i32 [ 0, %0 ], [ %A2, %Loop ] ; [#uses=3]
60 %B1 = phi i32 [ 0, %0 ], [ %B2, %Loop ] ; [#uses=1]
61 %A2 = add i32 %A1, 1 ; [#uses=1]
62 %B2 = add i32 %B1, %A1 ; [#uses=2]
63 %C = icmp eq i32 %A1, 1000 ; [#uses=1]
64 br i1 %C, label %Out, label %Loop
65
66 Out: ; preds = %Loop
67 ret i32 %B2
68 }
69
70 define i32 @chrec_equals() {
71 entry:
72 br label %no_exit
73
74 no_exit: ; preds = %no_exit, %entry
75 %i0 = phi i32 [ 0, %entry ], [ %i1, %no_exit ] ; [#uses=3]
76 %ISq = mul i32 %i0, %i0 ; [#uses=1]
77 %i1 = add i32 %i0, 1 ; [#uses=2]
78 %tmp.1 = icmp ne i32 %ISq, 10000 ; [#uses=1]
79 br i1 %tmp.1, label %no_exit, label %loopexit
80
81 loopexit: ; preds = %no_exit
82 ret i32 %i1
83 }
84
85 define i16 @cast_chrec_test() {
86 ;
87 br label %Loop
88
89 Loop: ; preds = %Loop, %0
90 %A1 = phi i32 [ 0, %0 ], [ %A2, %Loop ] ; [#uses=2]
91 %B1 = trunc i32 %A1 to i16 ; [#uses=2]
92 %A2 = add i32 %A1, 1 ; [#uses=1]
93 %C = icmp eq i16 %B1, 1000 ; [#uses=1]
94 br i1 %C, label %Out, label %Loop
95
96 Out: ; preds = %Loop
97 ret i16 %B1
98 }
99
100 define i32 @linear_div_fold() {
101 entry:
102 br label %loop
103
104 loop: ; preds = %loop, %entry
105 %i = phi i32 [ 4, %entry ], [ %i.next, %loop ] ; [#uses=3]
106 %i.next = add i32 %i, 8 ; [#uses=1]
107 %RV = udiv i32 %i, 2 ; [#uses=1]
108 %c = icmp ne i32 %i, 68 ; [#uses=1]
109 br i1 %c, label %loop, label %loopexit
110
111 loopexit: ; preds = %loop
112 ret i32 %RV
113 }
+0
-114
test/Transforms/IndVarsSimplify/exit_value_tests.llx less more
None ; Test that we can evaluate the exit values of various expression types. Since
1 ; these loops all have predictable exit values we can replace the use outside
2 ; of the loop with a closed-form computation, making the loop dead.
3 ;
4 ; RUN: llvm-as < %s | opt -indvars -adce -simplifycfg | \
5 ; RUN: llvm-dis | not grep br
6
7 define i32 @polynomial_constant() {
8 ;
9 br label %Loop
10
11 Loop: ; preds = %Loop, %0
12 %A1 = phi i32 [ 0, %0 ], [ %A2, %Loop ] ; [#uses=3]
13 %B1 = phi i32 [ 0, %0 ], [ %B2, %Loop ] ; [#uses=1]
14 %A2 = add i32 %A1, 1 ; [#uses=1]
15 %B2 = add i32 %B1, %A1 ; [#uses=2]
16 %C = icmp eq i32 %A1, 1000 ; [#uses=1]
17 br i1 %C, label %Out, label %Loop
18
19 Out: ; preds = %Loop
20 ret i32 %B2
21 }
22
23 define i32 @NSquare(i32 %N) {
24 ;
25 br label %Loop
26
27 Loop: ; preds = %Loop, %0
28 %X = phi i32 [ 0, %0 ], [ %X2, %Loop ] ; [#uses=4]
29 %X2 = add i32 %X, 1 ; [#uses=1]
30 %c = icmp eq i32 %X, %N ; [#uses=1]
31 br i1 %c, label %Out, label %Loop
32
33 Out: ; preds = %Loop
34 %Y = mul i32 %X, %X ; [#uses=1]
35 ret i32 %Y
36 }
37
38 define i32 @NSquareOver2(i32 %N) {
39 ;
40 br label %Loop
41
42 Loop: ; preds = %Loop, %0
43 %X = phi i32 [ 0, %0 ], [ %X2, %Loop ] ; [#uses=3]
44 %Y = phi i32 [ 15, %0 ], [ %Y2, %Loop ] ; [#uses=1]
45 %Y2 = add i32 %Y, %X ; [#uses=2]
46 %X2 = add i32 %X, 1 ; [#uses=1]
47 %c = icmp eq i32 %X, %N ; [#uses=1]
48 br i1 %c, label %Out, label %Loop
49
50 Out: ; preds = %Loop
51 ret i32 %Y2
52 }
53
54 define i32 @strength_reduced() {
55 ;
56 br label %Loop
57
58 Loop: ; preds = %Loop, %0
59 %A1 = phi i32 [ 0, %0 ], [ %A2, %Loop ] ; [#uses=3]
60 %B1 = phi i32 [ 0, %0 ], [ %B2, %Loop ] ; [#uses=1]
61 %A2 = add i32 %A1, 1 ; [#uses=1]
62 %B2 = add i32 %B1, %A1 ; [#uses=2]
63 %C = icmp eq i32 %A1, 1000 ; [#uses=1]
64 br i1 %C, label %Out, label %Loop
65
66 Out: ; preds = %Loop
67 ret i32 %B2
68 }
69
70 define i32 @chrec_equals() {
71 entry:
72 br label %no_exit
73
74 no_exit: ; preds = %no_exit, %entry
75 %i0 = phi i32 [ 0, %entry ], [ %i1, %no_exit ] ; [#uses=3]
76 %ISq = mul i32 %i0, %i0 ; [#uses=1]
77 %i1 = add i32 %i0, 1 ; [#uses=2]
78 %tmp.1 = icmp ne i32 %ISq, 10000 ; [#uses=1]
79 br i1 %tmp.1, label %no_exit, label %loopexit
80
81 loopexit: ; preds = %no_exit
82 ret i32 %i1
83 }
84
85 define i16 @cast_chrec_test() {
86 ;
87 br label %Loop
88
89 Loop: ; preds = %Loop, %0
90 %A1 = phi i32 [ 0, %0 ], [ %A2, %Loop ] ; [#uses=2]
91 %B1 = trunc i32 %A1 to i16 ; [#uses=2]
92 %A2 = add i32 %A1, 1 ; [#uses=1]
93 %C = icmp eq i16 %B1, 1000 ; [#uses=1]
94 br i1 %C, label %Out, label %Loop
95
96 Out: ; preds = %Loop
97 ret i16 %B1
98 }
99
100 define i32 @linear_div_fold() {
101 entry:
102 br label %loop
103
104 loop: ; preds = %loop, %entry
105 %i = phi i32 [ 4, %entry ], [ %i.next, %loop ] ; [#uses=3]
106 %i.next = add i32 %i, 8 ; [#uses=1]
107 %RV = udiv i32 %i, 2 ; [#uses=1]
108 %c = icmp ne i32 %i, 68 ; [#uses=1]
109 br i1 %c, label %loop, label %loopexit
110
111 loopexit: ; preds = %loop
112 ret i32 %RV
113 }
0 ; LFTR should eliminate the need for the computation of i*i completely. It
1 ; is only used to compute the exit value.
2 ; RUN: llvm-as < %s | opt -indvars -dce | llvm-dis | not grep mul
3
4 @A = external global i32 ; [#uses=1]
5
6 define i32 @quadratic_setlt() {
7 entry:
8 br label %loop
9
10 loop: ; preds = %loop, %entry
11 %i = phi i32 [ 7, %entry ], [ %i.next, %loop ] ; [#uses=5]
12 %i.next = add i32 %i, 1 ; [#uses=1]
13 store i32 %i, i32* @A
14 %i2 = mul i32 %i, %i ; [#uses=1]
15 %c = icmp slt i32 %i2, 1000 ; [#uses=1]
16 br i1 %c, label %loop, label %loopexit
17
18 loopexit: ; preds = %loop
19 ret i32 %i
20 }
21
+0
-22
test/Transforms/IndVarsSimplify/lftr_simple.llx less more
None ; LFTR should eliminate the need for the computation of i*i completely. It
1 ; is only used to compute the exit value.
2 ; RUN: llvm-as < %s | opt -indvars -dce | llvm-dis | not grep mul
3
4 @A = external global i32 ; [#uses=1]
5
6 define i32 @quadratic_setlt() {
7 entry:
8 br label %loop
9
10 loop: ; preds = %loop, %entry
11 %i = phi i32 [ 7, %entry ], [ %i.next, %loop ] ; [#uses=5]
12 %i.next = add i32 %i, 1 ; [#uses=1]
13 store i32 %i, i32* @A
14 %i2 = mul i32 %i, %i ; [#uses=1]
15 %c = icmp slt i32 %i2, 1000 ; [#uses=1]
16 br i1 %c, label %loop, label %loopexit
17
18 loopexit: ; preds = %loop
19 ret i32 %i
20 }
21
0 ; These tests ensure that we can compute the trip count of various forms of
1 ; loops. If the trip count of the loop is computable, then we will know what
2 ; the exit value of the loop will be for some value, allowing us to substitute
3 ; it directly into users outside of the loop, making the loop dead.
4 ;
5 ; RUN: llvm-as < %s | opt -indvars -adce -simplifycfg | llvm-dis | not grep br
6
7 define i32 @linear_setne() {
8 entry:
9 br label %loop
10
11 loop: ; preds = %loop, %entry
12 %i = phi i32 [ 0, %entry ], [ %i.next, %loop ] ; [#uses=3]
13 %i.next = add i32 %i, 1 ; [#uses=1]
14 %c = icmp ne i32 %i, 100 ; [#uses=1]
15 br i1 %c, label %loop, label %loopexit
16
17 loopexit: ; preds = %loop
18 ret i32 %i
19 }
20
21 define i32 @linear_setne_2() {
22 entry:
23 br label %loop
24
25 loop: ; preds = %loop, %entry
26 %i = phi i32 [ 0, %entry ], [ %i.next, %loop ] ; [#uses=3]
27 %i.next = add i32 %i, 2 ; [#uses=1]
28 %c = icmp ne i32 %i, 100 ; [#uses=1]
29 br i1 %c, label %loop, label %loopexit
30
31 loopexit: ; preds = %loop
32 ret i32 %i
33 }
34
35 define i32 @linear_setne_overflow() {
36 entry:
37 br label %loop
38
39 loop: ; preds = %loop, %entry
40 %i = phi i32 [ 1024, %entry ], [ %i.next, %loop ] ; [#uses=3]
41 %i.next = add i32 %i, 1024 ; [#uses=1]
42 %c = icmp ne i32 %i, 0 ; [#uses=1]
43 br i1 %c, label %loop, label %loopexit
44
45 loopexit: ; preds = %loop
46 ret i32 %i
47 }
48
49 define i32 @linear_setlt() {
50 entry:
51 br label %loop
52
53 loop: ; preds = %loop, %entry
54 %i = phi i32 [ 0, %entry ], [ %i.next, %loop ] ; [#uses=3]
55 %i.next = add i32 %i, 1 ; [#uses=1]
56 %c = icmp slt i32 %i, 100 ; [#uses=1]
57 br i1 %c, label %loop, label %loopexit
58
59 loopexit: ; preds = %loop
60 ret i32 %i
61 }
62
63 define i32 @quadratic_setlt() {
64 entry:
65 br label %loop
66
67 loop: ; preds = %loop, %entry
68 %i = phi i32 [ 7, %entry ], [ %i.next, %loop ] ; [#uses=4]
69 %i.next = add i32 %i, 3 ; [#uses=1]
70 %i2 = mul i32 %i, %i ; [#uses=1]
71 %c = icmp slt i32 %i2, 1000 ; [#uses=1]
72 br i1 %c, label %loop, label %loopexit
73
74 loopexit: ; preds = %loop
75 ret i32 %i
76 }
77
78 define i32 @chained() {
79 entry:
80 br label %loop
81
82 loop: ; preds = %loop, %entry
83 %i = phi i32 [ 0, %entry ], [ %i.next, %loop ] ; [#uses=3]
84 %i.next = add i32 %i, 1 ; [#uses=1]
85 %c = icmp ne i32 %i, 100 ; [#uses=1]
86 br i1 %c, label %loop, label %loopexit
87
88 loopexit: ; preds = %loop
89 br label %loop2
90
91 loop2: ; preds = %loop2, %loopexit
92 %j = phi i32 [ %i, %loopexit ], [ %j.next, %loop2 ] ; [#uses=3]
93 %j.next = add i32 %j, 1 ; [#uses=1]
94 %c2 = icmp ne i32 %j, 200 ; [#uses=1]
95 br i1 %c2, label %loop2, label %loopexit2
96
97 loopexit2: ; preds = %loop2
98 ret i32 %j
99 }
+0
-100
test/Transforms/IndVarsSimplify/tripcount_compute.llx less more
None ; These tests ensure that we can compute the trip count of various forms of
1 ; loops. If the trip count of the loop is computable, then we will know what
2 ; the exit value of the loop will be for some value, allowing us to substitute
3 ; it directly into users outside of the loop, making the loop dead.
4 ;
5 ; RUN: llvm-as < %s | opt -indvars -adce -simplifycfg | llvm-dis | not grep br
6
7 define i32 @linear_setne() {
8 entry:
9 br label %loop
10
11 loop: ; preds = %loop, %entry
12 %i = phi i32 [ 0, %entry ], [ %i.next, %loop ] ; [#uses=3]
13 %i.next = add i32 %i, 1 ; [#uses=1]
14 %c = icmp ne i32 %i, 100 ; [#uses=1]
15 br i1 %c, label %loop, label %loopexit
16
17 loopexit: ; preds = %loop
18 ret i32 %i
19 }
20
21 define i32 @linear_setne_2() {
22 entry:
23 br label %loop
24
25 loop: ; preds = %loop, %entry
26 %i = phi i32 [ 0, %entry ], [ %i.next, %loop ] ; [#uses=3]
27 %i.next = add i32 %i, 2 ; [#uses=1]
28 %c = icmp ne i32 %i, 100 ; [#uses=1]
29 br i1 %c, label %loop, label %loopexit
30
31 loopexit: ; preds = %loop
32 ret i32 %i
33 }
34
35 define i32 @linear_setne_overflow() {
36 entry:
37 br label %loop
38
39 loop: ; preds = %loop, %entry
40 %i = phi i32 [ 1024, %entry ], [ %i.next, %loop ] ; [#uses=3]
41 %i.next = add i32 %i, 1024 ; [#uses=1]
42 %c = icmp ne i32 %i, 0 ; [#uses=1]
43 br i1 %c, label %loop, label %loopexit
44
45 loopexit: ; preds = %loop
46 ret i32 %i
47 }
48
49 define i32 @linear_setlt() {
50 entry:
51 br label %loop
52
53 loop: ; preds = %loop, %entry
54 %i = phi i32 [ 0, %entry ], [ %i.next, %loop ] ; [#uses=3]
55 %i.next = add i32 %i, 1 ; [#uses=1]
56 %c = icmp slt i32 %i, 100 ; [#uses=1]
57 br i1 %c, label %loop, label %loopexit
58
59 loopexit: ; preds = %loop
60 ret i32 %i
61 }
62
63 define i32 @quadratic_setlt() {
64 entry:
65 br label %loop
66
67 loop: ; preds = %loop, %entry
68 %i = phi i32 [ 7, %entry ], [ %i.next, %loop ] ; [#uses=4]
69 %i.next = add i32 %i, 3 ; [#uses=1]
70 %i2 = mul i32 %i, %i ; [#uses=1]
71 %c = icmp slt i32 %i2, 1000 ; [#uses=1]
72 br i1 %c, label %loop, label %loopexit
73
74 loopexit: ; preds = %loop
75 ret i32 %i
76 }
77
78 define i32 @chained() {
79 entry:
80 br label %loop
81
82 loop: ; preds = %loop, %entry
83 %i = phi i32 [ 0, %entry ], [ %i.next, %loop ] ; [#uses=3]
84 %i.next = add i32 %i, 1 ; [#uses=1]
85 %c = icmp ne i32 %i, 100 ; [#uses=1]
86 br i1 %c, label %loop, label %loopexit
87
88 loopexit: ; preds = %loop
89 br label %loop2
90
91 loop2: ; preds = %loop2, %loopexit
92 %j = phi i32 [ %i, %loopexit ], [ %j.next, %loop2 ] ; [#uses=3]
93 %j.next = add i32 %j, 1 ; [#uses=1]
94 %c2 = icmp ne i32 %j, 200 ; [#uses=1]
95 br i1 %c2, label %loop2, label %loopexit2
96
97 loopexit2: ; preds = %loop2
98 ret i32 %j
99 }
0 ; These tests have an infinite trip count. We obviously shouldn't remove the
1 ; loops! :)
2 ;
3 ; RUN: llvm-as < %s | opt -indvars -adce -simplifycfg | llvm-dis | grep icmp | wc -l > %t2
4 ; RUN: llvm-as < %s | llvm-dis | grep icmp | wc -l > %t1
5 ; RUN: diff %t1 %t2
6
7 ;; test for (i = 1; i != 100; i += 2)
8 define i32 @infinite_linear() {
9 entry:
10 br label %loop
11
12 loop: ; preds = %loop, %entry
13 %i = phi i32 [ 1, %entry ], [ %i.next, %loop ] ; [#uses=3]
14 %i.next = add i32 %i, 2 ; [#uses=1]
15 %c = icmp ne i32 %i, 100 ; [#uses=1]
16 br i1 %c, label %loop, label %loopexit
17
18 loopexit: ; preds = %loop
19 ret i32 %i
20 }
21
22 ;; test for (i = 1; i*i != 63; ++i)
23 define i32 @infinite_quadratic() {
24 entry:
25 br label %loop
26
27 loop: ; preds = %loop, %entry
28 %i = phi i32 [ 1, %entry ], [ %i.next, %loop ] ; [#uses=4]
29 %isquare = mul i32 %i, %i ; [#uses=1]
30 %i.next = add i32 %i, 1 ; [#uses=1]
31 %c = icmp ne i32 %isquare, 63 ; [#uses=1]
32 br i1 %c, label %loop, label %loopexit
33
34 loopexit: ; preds = %loop
35 ret i32 %i
36 }
37
+0
-38
test/Transforms/IndVarsSimplify/tripcount_infinite.llx less more
None ; These tests have an infinite trip count. We obviously shouldn't remove the
1 ; loops! :)
2 ;
3 ; RUN: llvm-as < %s | opt -indvars -adce -simplifycfg | llvm-dis | grep icmp | wc -l > %t2
4 ; RUN: llvm-as < %s | llvm-dis | grep icmp | wc -l > %t1
5 ; RUN: diff %t1 %t2
6
7 ;; test for (i = 1; i != 100; i += 2)
8 define i32 @infinite_linear() {
9 entry:
10 br label %loop
11
12 loop: ; preds = %loop, %entry
13 %i = phi i32 [ 1, %entry ], [ %i.next, %loop ] ; [#uses=3]
14 %i.next = add i32 %i, 2 ; [#uses=1]
15 %c = icmp ne i32 %i, 100 ; [#uses=1]
16 br i1 %c, label %loop, label %loopexit
17
18 loopexit: ; preds = %loop
19 ret i32 %i
20 }
21
22 ;; test for (i = 1; i*i != 63; ++i)
23 define i32 @infinite_quadratic() {
24 entry:
25 br label %loop
26
27 loop: ; preds = %loop, %entry
28 %i = phi i32 [ 1, %entry ], [ %i.next, %loop ] ; [#uses=4]
29 %isquare = mul i32 %i, %i ; [#uses=1]
30 %i.next = add i32 %i, 1 ; [#uses=1]
31 %c = icmp ne i32 %isquare, 63 ; [#uses=1]
32 br i1 %c, label %loop, label %loopexit
33
34 loopexit: ; preds = %loop
35 ret i32 %i
36 }
37
0 ; RUN: llvm-as < %s | opt -inline -prune-eh -disable-output
1
2 define linkonce void @caller() {
3 call void @callee( )
4 ret void
5 }
6
7 define linkonce void @callee() {
8 ret void
9 }
10
+0
-11
test/Transforms/Inline/2004-04-20-InlineLinkOnce.llx less more
None ; RUN: llvm-as < %s | opt -inline -prune-eh -disable-output
1
2 define linkonce void @caller() {
3 call void @callee( )
4 ret void
5 }
6
7 define linkonce void @callee() {
8 ret void
9 }
10
0 ; RUN: llvm-as < %s | opt -instcombine
1
2 ; This testcase should not send the instcombiner into an infinite loop!
3
4 define i32 @test(i32 %X) {
5 %Y = srem i32 %X, 0 ; [#uses=1]
6 ret i32 %Y
7 }
8
+0
-9
test/Transforms/InstCombine/2004-08-09-RemInfLoop.llx less more
None ; RUN: llvm-as < %s | opt -instcombine
1
2 ; This testcase should not send the instcombiner into an infinite loop!
3
4 define i32 @test(i32 %X) {
5 %Y = srem i32 %X, 0 ; [#uses=1]
6 ret i32 %Y
7 }
8
0 ; RUN: llvm-as < %s | opt -instcombine -mem2reg | llvm-dis | \
1 ; RUN: not grep {i32 1}
2
3 ; When propagating the load through the select, make sure that the load is
4 ; inserted where the original load was, not where the select is. Not doing
5 ; so could produce incorrect results!
6
7 define i32 @test(i1 %C) {
8 %X = alloca i32 ; [#uses=3]
9 %X2 = alloca i32 ; [#uses=2]
10 store i32 1, i32* %X
11 store i32 2, i32* %X2
12 %Y = select i1 %C, i32* %X, i32* %X2 ; [#uses=1]
13 store i32 3, i32* %X
14 %Z = load i32* %Y ; [#uses=1]
15 ret i32 %Z
16 }
17
+0
-18
test/Transforms/InstCombine/2004-09-20-BadLoadCombine.llx less more
None ; RUN: llvm-as < %s | opt -instcombine -mem2reg | llvm-dis | \
1 ; RUN: not grep {i32 1}
2
3 ; When propagating the load through the select, make sure that the load is
4 ; inserted where the original load was, not where the select is. Not doing
5 ; so could produce incorrect results!
6
7 define i32 @test(i1 %C) {
8 %X = alloca i32 ; [#uses=3]
9 %X2 = alloca i32 ; [#uses=2]
10 store i32 1, i32* %X
11 store i32 2, i32* %X2
12 %Y = select i1 %C, i32* %X, i32* %X2 ; [#uses=1]
13 store i32 3, i32* %X
14 %Z = load i32* %Y ; [#uses=1]
15 ret i32 %Z
16 }
17
0 ; RUN: llvm-as < %s | opt -instcombine -mem2reg -simplifycfg | \
1 ; RUN: llvm-dis | grep -v store | not grep {int 1}
2
3 ; Test to make sure that instcombine does not accidentally propagate the load
4 ; into the PHI, which would break the program.
5
6 define i32 @test(i1 %C) {
7 entry:
8 %X = alloca i32 ; [#uses=3]
9 %X2 = alloca i32 ; [#uses=2]
10 store i32 1, i32* %X
11 store i32 2, i32* %X2
12 br i1 %C, label %cond_true.i, label %cond_continue.i
13
14 cond_true.i: ; preds = %entry
15 br label %cond_continue.i
16
17 cond_continue.i: ; preds = %cond_true.i, %entry
18 %mem_tmp.i.0 = phi i32* [ %X, %cond_true.i ], [ %X2, %entry ] ; [#uses=1]
19 store i32 3, i32* %X
20 %tmp.3 = load i32* %mem_tmp.i.0 ; [#uses=1]
21 ret i32 %tmp.3
22 }
23
24
+0
-25
test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.llx less more
None ; RUN: llvm-as < %s | opt -instcombine -mem2reg -simplifycfg | \
1 ; RUN: llvm-dis | grep -v store | not grep {int 1}
2
3 ; Test to make sure that instcombine does not accidentally propagate the load
4 ; into the PHI, which would break the program.
5
6 define i32 @test(i1 %C) {
7 entry:
8 %X = alloca i32 ; [#uses=3]
9 %X2 = alloca i32 ; [#uses=2]
10 store i32 1, i32* %X
11 store i32 2, i32* %X2
12 br i1 %C, label %cond_true.i, label %cond_continue.i
13
14 cond_true.i: ; preds = %entry
15 br label %cond_continue.i
16
17 cond_continue.i: ; preds = %cond_true.i, %entry
18 %mem_tmp.i.0 = phi i32* [ %X, %cond_true.i ], [ %X2, %entry ] ; [#uses=1]
19 store i32 3, i32* %X
20 %tmp.3 = load i32* %mem_tmp.i.0 ; [#uses=1]
21 ret i32 %tmp.3
22 }
23
24
0 ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep -- -65536
1
2 define i1 @test(i32 %tmp.124) {
3 %tmp.125 = shl i32 %tmp.124, 8 ; [#uses=1]
4 %tmp.126.mask = and i32 %tmp.125, -16777216 ; [#uses=1]
5 %tmp.128 = icmp eq i32 %tmp.126.mask, 167772160 ; [#uses=1]
6 ret i1 %tmp.128
7 }
8
+0
-9
test/Transforms/InstCombine/2004-09-28-BadShiftAndSetCC.llx less more
None ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep -- -65536
1
2 define i1 @test(i32 %tmp.124) {
3 %tmp.125 = shl i32 %tmp.124, 8 ; [#uses=1]
4 %tmp.126.mask = and i32 %tmp.125, -16777216 ; [#uses=1]
5 %tmp.128 = icmp eq i32 %tmp.126.mask, 167772160 ; [#uses=1]
6 ret i1 %tmp.128
7 }
8
0 ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
1 ; RUN: grep select | not grep {i32\\*}
2
3 ; This testcase corresponds to PR362, which notices that this horrible code
4 ; is generated by the C++ front-end and LLVM optimizers, which has lots of
5 ; loads and other stuff that are unneeded.
6 ;
7 ; Instcombine should propagate the load through the select instructions to
8 ; allow elimination of the extra stuff by the mem2reg pass.
9
10 define void @_Z5test1RiS_(i32* %x, i32* %y) {
11 entry:
12 %tmp.1.i = load i32* %y ; [#uses=1]
13 %tmp.3.i = load i32* %x ; [#uses=1]
14 %tmp.4.i = icmp slt i32 %tmp.1.i, %tmp.3.i ; [#uses=1]
15 %retval.i = select i1 %tmp.4.i, i32* %y, i32* %x ; [#uses=1]
16 %tmp.4 = load i32* %retval.i ; [#uses=1]
17 store i32 %tmp.4, i32* %x
18 ret void
19 }
20
21 define void @_Z5test2RiS_(i32* %x, i32* %y) {
22 entry:
23 %tmp.0 = alloca i32 ; [#uses=2]
24 %tmp.2 = load i32* %x ; [#uses=2]
25 store i32 %tmp.2, i32* %tmp.0
26 %tmp.3.i = load i32* %y ; [#uses=1]
27 %tmp.4.i = icmp slt i32 %tmp.2, %tmp.3.i ; [#uses=1]
28 %retval.i = select i1 %tmp.4.i, i32* %y, i32* %tmp.0 ; [#uses=1]
29 %tmp.6 = load i32* %retval.i ; [#uses=1]
30 store i32 %tmp.6, i32* %y
31 ret void
32 }
33
+0
-34
test/Transforms/InstCombine/CPP_min_max.llx less more
None ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
1 ; RUN: grep select | not grep {i32\\*}
2
3 ; This testcase corresponds to PR362, which notices that this horrible code
4 ; is generated by the C++ front-end and LLVM optimizers, which has lots of
5 ; loads and other stuff that are unneeded.
6 ;
7 ; Instcombine should propagate the load through the select instructions to
8 ; allow elimination of the extra stuff by the mem2reg pass.
9
10 define void @_Z5test1RiS_(i32* %x, i32* %y) {
11 entry:
12 %tmp.1.i = load i32* %y ; [#uses=1]
13 %tmp.3.i = load i32* %x ; [#uses=1]
14 %tmp.4.i = icmp slt i32 %tmp.1.i, %tmp.3.i ; [#uses=1]
15 %retval.i = select i1 %tmp.4.i, i32* %y, i32* %x ; [#uses=1]
16 %tmp.4 = load i32* %retval.i ; [#uses=1]
17 store i32 %tmp.4, i32* %x
18 ret void
19 }
20
21 define void @_Z5test2RiS_(i32* %x, i32* %y) {
22 entry:
23 %tmp.0 = alloca i32 ; [#uses=2]
24 %tmp.2 = load i32* %x ; [#uses=2]
25 store i32 %tmp.2, i32* %tmp.0
26 %tmp.3.i = load i32* %y ; [#uses=1]
27 %tmp.4.i = icmp slt i32 %tmp.2, %tmp.3.i ; [#uses=1]
28 %retval.i = select i1 %tmp.4.i, i32* %y, i32* %tmp.0 ; [#uses=1]
29 %tmp.6 = load i32* %retval.i ; [#uses=1]
30 store i32 %tmp.6, i32* %y
31 ret void
32 }
33
0 ; RUN: llvm-as < %s | opt -globalsmodref-aa -licm -disable-output
1
2 @PL_regcomp_parse = internal global i8* null ; [#uses=2]
3
4 define void @test() {
5 br label %Outer
6 Outer: ; preds = %Next, %0
7 br label %Inner
8 Inner: ; preds = %Inner, %Outer
9 %tmp.114.i.i.i = load i8** @PL_regcomp_parse ; [#uses=1]
10 %tmp.115.i.i.i = load i8* %tmp.114.i.i.i ; [#uses=0]
11 store i8* null, i8** @PL_regcomp_parse
12 br i1 false, label %Inner, label %Next
13 Next: ; preds = %Inner
14 br i1 false, label %Outer, label %Exit
15 Exit: ; preds = %Next
16 ret void
17 }
18
+0
-19
test/Transforms/LICM/2004-09-14-AliasAnalysisInvalidate.llx less more
None ; RUN: llvm-as < %s | opt -globalsmodref-aa -licm -disable-output
1
2 @PL_regcomp_parse = internal global i8* null ; [#uses=2]
3
4 define void @test() {
5 br label %Outer
6 Outer: ; preds = %Next, %0
7 br label %Inner
8 Inner: ; preds = %Inner, %Outer
9 %tmp.114.i.i.i = load i8** @PL_regcomp_parse ; [#uses=1]
10 %tmp.115.i.i.i = load i8* %tmp.114.i.i.i ; [#uses=0]
11 store i8* null, i8** @PL_regcomp_parse
12 br i1 false, label %Inner, label %Next
13 Next: ; preds = %Inner
14 br i1 false, label %Outer, label %Exit
15 Exit: ; preds = %Next
16 ret void
17 }
18
0 ; This testcase was reduced from Shootout-C++/reversefile.cpp by bugpoint
1
2 ; RUN: llvm-as < %s | opt -lowerinvoke -disable-output
3
4 declare void @baz()
5
6 declare void @bar()
7
8 define void @foo() {
9 then:
10 invoke void @baz( )
11 to label %invoke_cont.0 unwind label %try_catch
12 invoke_cont.0: ; preds = %then
13 invoke void @bar( )
14 to label %try_exit unwind label %try_catch
15 try_catch: ; preds = %invoke_cont.0, %then
16 %__tmp.0 = phi i32* [ null, %invoke_cont.0 ], [ null, %then ] ; [#uses=0]
17 ret void
18 try_exit: ; preds = %invoke_cont.0
19 ret void
20 }
21
+0
-22
test/Transforms/LowerInvoke/2003-12-10-Crash.llx less more
None ; This testcase was reduced from Shootout-C++/reversefile.cpp by bugpoint
1
2 ; RUN: llvm-as < %s | opt -lowerinvoke -disable-output
3
4 declare void @baz()
5
6 declare void @bar()
7
8 define void @foo() {
9 then:
10 invoke void @baz( )
11 to label %invoke_cont.0 unwind label %try_catch
12 invoke_cont.0: ; preds = %then
13 invoke void @bar( )
14 to label %try_exit unwind label %try_catch
15 try_catch: ; preds = %invoke_cont.0, %then
16 %__tmp.0 = phi i32* [ null, %invoke_cont.0 ], [ null, %then ] ; [#uses=0]
17 ret void
18 try_exit: ; preds = %invoke_cont.0
19 ret void
20 }
21
0 ; RUN: llvm-as < %s | opt -lowerinvoke -enable-correct-eh-support -disable-output
1
2 define void @_ZNKSt11__use_cacheISt16__numpunct_cacheIcEEclERKSt6locale() {
3 entry:
4 br i1 false, label %then, label %UnifiedReturnBlock
5 then: ; preds = %entry
6 invoke void @_Znwj( )
7 to label %UnifiedReturnBlock unwind label %UnifiedReturnBlock
8 UnifiedReturnBlock: ; preds = %then, %then, %entry
9 %UnifiedRetVal = phi i32* [ null, %entry ], [ null, %then ], [ null, %then ] ; [#uses=0]
10 ret void
11 }
12
13 declare void @_Znwj()
14
+0
-15
test/Transforms/LowerInvoke/2004-02-29-PHICrash.llx less more
None ; RUN: llvm-as < %s | opt -lowerinvoke -enable-correct-eh-support -disable-output
1
2 define void @_ZNKSt11__use_cacheISt16__numpunct_cacheIcEEclERKSt6locale() {
3 entry:
4 br i1 false, label %then, label %UnifiedReturnBlock
5 then: ; preds = %entry
6 invoke void @_Znwj( )
7 to label %UnifiedReturnBlock unwind label %UnifiedReturnBlock
8 UnifiedReturnBlock: ; preds = %then, %then, %entry
9 %UnifiedRetVal = phi i32* [ null, %entry ], [ null, %then ], [ null, %then ] ; [#uses=0]
10 ret void
11 }
12
13 declare void @_Znwj()
14
0 ; RUN: llvm-as < %s | opt -prune-eh | llvm-dis | grep invoke
1
2 declare void @External()
3
4 define void @foo() {
5 invoke void @External( )
6 to label %Cont unwind label %Cont
7 Cont: ; preds = %0, %0
8 ret void
9 }
10
+0
-11
test/Transforms/PruneEH/2003-09-14-ExternalCall.llx less more
None ; RUN: llvm-as < %s | opt -prune-eh | llvm-dis | grep invoke
1
2 declare void @External()
3
4 define void @foo() {
5 invoke void @External( )
6 to label %Cont unwind label %Cont
7 Cont: ; preds = %0, %0
8 ret void
9 }
10
0 ; RUN: llvm-as < %s | opt -prune-eh -disable-output
1
2 define internal void @callee() {
3 ret void
4 }
5
6 define i32 @caller() {
7 ;
8 invoke void @callee( )
9 to label %E unwind label %E
10 E: ; preds = %0, %0
11 %X = phi i32 [ 0, %0 ], [ 0, %0 ] ; [#uses=1]
12 ret i32 %X
13 }
14
+0
-15
test/Transforms/PruneEH/2003-11-21-PHIUpdate.llx less more
None ; RUN: llvm-as < %s | opt -prune-eh -disable-output
1
2 define internal void @callee() {
3 ret void
4 }
5
6 define i32 @caller() {
7 ;
8 invoke void @callee( )
9 to label %E unwind label %E
10 E: ; preds = %0, %0
11 %X = phi i32 [ 0, %0 ], [ 0, %0 ] ; [#uses=1]
12 ret i32 %X
13 }
14
0 ; RUN: llvm-as < %s | opt -prune-eh | llvm-dis | not grep invoke
1
2 define internal i32 @foo() {
3 invoke i32 @foo( )
4 to label %Normal unwind label %Except ; :1 [#uses=0]
5 Normal: ; preds = %0
6 ret i32 12
7 Except: ; preds = %0
8 ret i32 123
9 }
10
11 define i32 @caller() {
12 invoke i32 @foo( )
13 to label %Normal unwind label %Except ; :1 [#uses=0]
14 Normal: ; preds = %0
15 ret i32 0
16 Except: ; preds = %0
17 ret i32 1
18 }
19
+0
-20
test/Transforms/PruneEH/recursivetest.llx less more
None ; RUN: llvm-as < %s | opt -prune-eh | llvm-dis | not grep invoke
1
2 define internal i32 @foo() {
3 invoke i32 @foo( )
4 to label %Normal unwind label %Except ; :1 [#uses=0]
5 Normal: ; preds = %0
6 ret i32 12
7 Except: ; preds = %0
8 ret i32 123
9 }
10
11 define i32 @caller() {
12 invoke i32 @foo( )
13 to label %Normal unwind label %Except ; :1 [#uses=0]
14 Normal: ; preds = %0
15 ret i32 0
16 Except: ; preds = %0
17 ret i32 1
18 }
19
0 ; RUN: llvm-as < %s | opt -tailduplicate -disable-output
1
2 define void @interpret() {
3 entry:
4 br label %retry
5 retry: ; preds = %endif.4, %entry
6 %tmp.8 = call i32 @interp( ) ; [#uses=3]
7 switch i32 0, label %endif.4 [
8 i32 -25, label %return
9 i32 -16, label %return
10 ]
11 endif.4: ; preds = %retry
12 br i1 false, label %return, label %retry
13 return: ; preds = %endif.4, %retry, %retry
14 %result.0 = phi i32 [ %tmp.8, %retry ], [ %tmp.8, %retry ], [ %tmp.8, %endif.4 ] ; [#uses=0]
15 ret void
16 }
17
18 declare i32 @interp()
19
+0
-20
test/Transforms/TailDup/2004-04-01-DemoteRegToStack.llx less more
None ; RUN: llvm-as < %s | opt -tailduplicate -disable-output
1
2 define void @interpret() {
3 entry:
4 br label %retry
5 retry: ; preds = %endif.4, %entry
6 %tmp.8 = call i32 @interp( ) ; [#uses=3]
7 switch i32 0, label %endif.4 [
8 i32 -25, label %return
9 i32 -16, label %return
10 ]
11 endif.4: ; preds = %retry
12 br i1 false, label %return, label %retry
13 return: ; preds = %endif.4, %retry, %retry
14 %result.0 = phi i32 [ %tmp.8, %retry ], [ %tmp.8, %retry ], [ %tmp.8, %endif.4 ] ; [#uses=0]
15 ret void
16 }
17
18 declare i32 @interp()
19