llvm.org GIT mirror llvm / 7c856c0
Remove GCSE and LoadVN from the testsuite. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54832 91177308-0d34-0410-b5e6-96231b3b80d8 Owen Anderson 11 years ago
41 changed file(s) with 25 addition(s) and 308 deletion(s). Raw diff Collapse all Expand all
+0
-15
test/Analysis/Andersens/arg-must-alias.ll less more
None ; RUN: llvm-as < %s | opt -anders-aa -load-vn -gcse -deadargelim | llvm-dis | not grep ARG
1
2 @G = internal constant i32* null
3
4 define internal i32 @internal(i32* %ARG) {
5 ;; The 'Arg' argument must-aliases the null pointer, so it can be subsituted
6 ;; directly here, making it dead.
7 store i32* %ARG, i32** @G
8 ret i32 0
9 }
10
11 define i32 @foo() {
12 %V = call i32 @internal(i32* null)
13 ret i32 %V
14 }
None ; RUN: llvm-as < %s | opt -anders-aa -load-vn -gcse -deadargelim | llvm-dis | grep store | not grep null
0 ; RUN: llvm-as < %s | opt -anders-aa -gvn -deadargelim | llvm-dis | grep store | not grep null
11
22 ; Because the 'internal' function is passed to an external function, we don't
33 ; know what the incoming values will alias. As such, we cannot do the
None ; RUN: llvm-as < %s | opt -anders-aa -load-vn -gcse -instcombine | llvm-dis \
0 ; RUN: llvm-as < %s | opt -anders-aa -gvn -instcombine | llvm-dis \
11 ; RUN: | grep {ret i1 true}
22
33 @G = internal global i32* null
11 ; is performed. It is not legal to delete the second load instruction because
22 ; the value computed by the first load instruction is changed by the store.
33
4 ; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | llvm-dis | grep DONOTREMOVE
4 ; RUN: llvm-as < %s | opt -gvn -instcombine | llvm-dis | grep DONOTREMOVE
55
66 define i32 @test() {
77 %A = alloca i32
None ; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | llvm-dis | grep sub
0 ; RUN: llvm-as < %s | opt -gvn -instcombine | llvm-dis | grep sub
11
22 ; BasicAA was incorrectly concluding that P1 and P2 didn't conflict!
33
0 ; In this test, a local alloca cannot alias an incoming argument.
11
2 ; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | llvm-dis | not grep sub
2 ; RUN: llvm-as < %s | opt -gvn -instcombine | llvm-dis | not grep sub
33
44 define i32 @test(i32* %P) {
55 %X = alloca i32
+0
-13
test/Analysis/BasicAA/2004-01-29-InvariantMemory.ll 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 }
None ; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine |\
0 ; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine |\
11 ; RUN: llvm-dis | grep {load i32\\* %A}
22
33 declare double* @useit(i32*)
0 ; PR1109
1 ; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | \
1 ; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine | llvm-dis | \
22 ; RUN: grep {sub i32}
3 ; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | \
3 ; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine | llvm-dis | \
44 ; RUN: not grep {ret i32 0}
55 ; END.
66
0 ; PR1600
1 ; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | \
1 ; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine | llvm-dis | \
22 ; RUN: grep {ret i32 0}
33 ; END.
44
0 ; This testcase tests for various features the basicaa test should be able to
11 ; determine, as noted in the comments.
22
3 ; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine -dce | llvm-dis | not grep REMOVE
3 ; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine -dce | llvm-dis | not grep REMOVE
44
55 @Global = external global { i32 }
66
11 ; disambiguating some obvious cases. All loads should be removable in
22 ; this testcase.
33
4 ; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine -dce \
4 ; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine -dce \
55 ; RUN: | llvm-dis | not grep load
66
77 @A = global i32 7
0 ; A store or load cannot alias a global if the accessed amount is larger then
11 ; the global.
22
3 ; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep load
3 ; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine | llvm-dis | not grep load
44
55 @B = global i16 8 ; [#uses=2]
66
None ; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine |\
0 ; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine |\
11 ; RUN: llvm-dis | grep {ret i32 0}
22
33 declare void @foo(i32*)
None ; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load
0 ; RUN: llvm-as < %s | opt -globalsmodref-aa -gvn | llvm-dis | not grep load
11 @X = internal global i32 4 ; [#uses=1]
22
33 define i32 @test(i32* %P) {
None ; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load
0 ; RUN: llvm-as < %s | opt -globalsmodref-aa -gvn | llvm-dis | not grep load
11
22 ; This test requires the use of previous analyses to determine that
33 ; doesnotmodX does not modify X (because 'sin' doesn't).
None ; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse -instcombine | llvm-dis | \
0 ; RUN: llvm-as < %s | opt -globalsmodref-aa -gvn -instcombine | llvm-dis | \
11 ; RUN: grep {ret i32 0}
22
33 @G = internal global i32* null ; [#uses=3]
None ; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load
0 ; RUN: llvm-as < %s | opt -globalsmodref-aa -gvn | llvm-dis | not grep load
11 @X = internal global i32 4 ; [#uses=2]
22
33 define i32 @test(i32* %P) {
0 ; Test that pure functions are cse'd away
1 ; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse -instcombine | \
1 ; RUN: llvm-as < %s | opt -globalsmodref-aa -gvn -instcombine | \
22 ; RUN: llvm-dis | not grep sub
33
44 define i32 @pure(i32 %X) {
+0
-25
test/Analysis/LoadVN/RLE-Eliminate.ll less more
None ; This testcase ensures that redundant loads are eliminated when they should
1 ; be. All RL variables (redundant loads) should be eliminated.
2 ;
3 ; RUN: llvm-as < %s | opt -load-vn -gcse | llvm-dis | not grep %RL
4 ;
5
6 define i32 @test1(i32* %P) {
7 %A = load i32* %P ; [#uses=1]
8 %RL = load i32* %P ; [#uses=1]
9 %C = add i32 %A, %RL ; [#uses=1]
10 ret i32 %C
11 }
12
13 define i32 @test2(i32* %P) {
14 %A = load i32* %P ; [#uses=1]
15 br label %BB2
16
17 BB2: ; preds = %0
18 br label %BB3
19
20 BB3: ; preds = %BB2
21 %RL = load i32* %P ; [#uses=1]
22 %B = add i32 %A, %RL ; [#uses=1]
23 ret i32 %B
24 }
+0
-8
test/Analysis/LoadVN/RLE-Preserve-Volatile.ll less more
None ; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | llvm-dis | grep sub
1
2 define i32 @test(i32* %P) {
3 %X = volatile load i32* %P ; [#uses=1]
4 %Y = volatile load i32* %P ; [#uses=1]
5 %Z = sub i32 %X, %Y ; [#uses=1]
6 ret i32 %Z
7 }
+0
-26
test/Analysis/LoadVN/RLE-Preserve.ll less more
None ; This testcase ensures that redundant loads are preserved when they are not
1 ; allowed to be eliminated.
2 ; RUN: llvm-as < %s | opt -load-vn -gcse | llvm-dis | grep sub
3 ;
4
5 define i32 @test1(i32* %P) {
6 %A = load i32* %P ; [#uses=1]
7 store i32 1, i32* %P
8 %B = load i32* %P ; [#uses=1]
9 %C = sub i32 %A, %B ; [#uses=1]
10 ret i32 %C
11 }
12
13 define i32 @test2(i32* %P) {
14 %A = load i32* %P ; [#uses=1]
15 br label %BB2
16
17 BB2: ; preds = %0
18 store i32 5, i32* %P
19 br label %BB3
20
21 BB3: ; preds = %BB2
22 %B = load i32* %P ; [#uses=1]
23 %C = sub i32 %A, %B ; [#uses=1]
24 ret i32 %C
25 }
+0
-12
test/Analysis/LoadVN/call_cse.ll less more
None ; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep sub
1
2 declare i32 @strlen(i8*) readonly
3
4 define i32 @test(i8* %P) {
5 %X = call i32 @strlen( i8* %P ) readonly ; [#uses=2]
6 %A = add i32 %X, 14 ; [#uses=1]
7 %Y = call i32 @strlen( i8* %P ) readonly ; [#uses=1]
8 %Z = sub i32 %X, %Y ; [#uses=1]
9 %B = add i32 %A, %Z ; [#uses=1]
10 ret i32 %B
11 }
+0
-14
test/Analysis/LoadVN/call_pure_function.ll less more
None ; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep sub
1
2 declare i32 @strlen(i8*) readonly
3
4 declare void @use(i32)
5
6 define i8 @test(i8* %P, i8* %Q) {
7 %A = load i8* %Q ; [#uses=1]
8 %X = call i32 @strlen( i8* %P ) readonly ; [#uses=1]
9 %B = load i8* %Q ; [#uses=1]
10 call void @use( i32 %X )
11 %C = sub i8 %A, %B ; [#uses=1]
12 ret i8 %C
13 }
+0
-13
test/Analysis/LoadVN/casts.ll less more
None ; Check to make sure that Value Numbering doesn't merge casts of different
1 ; flavors.
2 ; RUN: llvm-as < %s | opt -load-vn -gcse | llvm-dis | \
3 ; RUN: grep {\[sz\]ext} | count 2
4
5 declare void @external(i32)
6
7 define i32 @test_casts(i16 %x) {
8 %a = sext i16 %x to i32 ; [#uses=1]
9 %b = zext i16 %x to i32 ; [#uses=1]
10 call void @external( i32 %a )
11 ret i32 %b
12 }
+0
-25
test/Analysis/LoadVN/dependent_loads.ll less more
None ; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | \
1 ; RUN: llvm-dis | not grep sub
2
3 %S = type { i32, i8 }
4
5 define i8 @test(i8** %P) {
6 %A = load i8** %P ; [#uses=1]
7 %B = load i8* %A ; [#uses=1]
8 %X = load i8** %P ; [#uses=1]
9 %Y = load i8* %X ; [#uses=1]
10 %R = sub i8 %B, %Y ; [#uses=1]
11 ret i8 %R
12 }
13
14 define i8 @test1(%S** %P) {
15 %A = load %S** %P ; <%S*> [#uses=1]
16 %B = getelementptr %S* %A, i32 0, i32 1 ; [#uses=1]
17 %C = load i8* %B ; [#uses=1]
18 %X = load %S** %P ; <%S*> [#uses=1]
19 %Y = getelementptr %S* %X, i32 0, i32 1 ; [#uses=1]
20 %Z = load i8* %Y ; [#uses=1]
21 %R = sub i8 %C, %Z ; [#uses=1]
22 ret i8 %R
23 }
24
+0
-3
test/Analysis/LoadVN/dg.exp less more
None load_lib llvm.exp
1
2 RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
+0
-14
test/Analysis/LoadVN/undefined_load.ll less more
None ; RUN: llvm-as < %s | opt -load-vn -gcse | llvm-dis | not grep load
1 ; Test that loads of undefined memory are eliminated.
2
3 define i32 @test1() {
4 %X = malloc i32 ; [#uses=1]
5 %Y = load i32* %X ; [#uses=1]
6 ret i32 %Y
7 }
8
9 define i32 @test2() {
10 %X = alloca i32 ; [#uses=1]
11 %Y = load i32* %X ; [#uses=1]
12 ret i32 %Y
13 }
None ; RUN: llvm-as < %s | opt -domtree -gcse -domtree -constmerge -disable-output
0 ; RUN: llvm-as < %s | opt -domtree -gvn -domtree -constmerge -disable-output
11
22 define i32 @test1() {
33 unreachable
+0
-17
test/Transforms/GCSE/2002-05-14-OperandSwap.ll less more
None ; This entire chain of computation should be optimized away, but
1 ; wasn't because the two multiplies were not detected as being identical.
2 ;
3 ; RUN: llvm-as < %s | opt -gcse -instcombine -dce | \
4 ; RUN: llvm-dis | not grep sub
5
6 define i32 @vnum_test4(i32* %data) {
7 %idx1 = getelementptr i32* %data, i64 1 ; [#uses=1]
8 %idx2 = getelementptr i32* %data, i64 3 ; [#uses=1]
9 %reg1101 = load i32* %idx1 ; [#uses=2]
10 %reg1111 = load i32* %idx2 ; [#uses=2]
11 %reg109 = mul i32 %reg1101, %reg1111 ; [#uses=1]
12 %reg108 = mul i32 %reg1111, %reg1101 ; [#uses=1]
13 %reg121 = sub i32 %reg108, %reg109 ; [#uses=1]
14 ret i32 %reg121
15 }
16
+0
-14
test/Transforms/GCSE/2002-05-21-NoSharedDominator.ll less more
None ; This testcase shows a bug where an common subexpression exists, but there
1 ; is no shared dominator block that the expression can be hoisted out to.
2 ;
3 ; RUN: llvm-as < %s | opt -gcse | llvm-dis
4
5 define i32 @test(i32 %X, i32 %Y) {
6 %Z = add i32 %X, %Y ; [#uses=1]
7 ret i32 %Z
8
9 Unreachable: ; No predecessors!
10 %Q = add i32 %X, %Y ; [#uses=1]
11 ret i32 %Q
12 }
13
+0
-11
test/Transforms/GCSE/2003-06-13-LoadStoreEliminate.ll less more
None ; This testcase shows a bug where an common subexpression exists, but there
1 ; is no shared dominator block that the expression can be hoisted out to.
2 ;
3 ; RUN: llvm-as < %s | opt -load-vn -gcse | llvm-dis | not grep load
4
5 define i32 @test(i32* %P) {
6 store i32 5, i32* %P
7 %Z = load i32* %P ; [#uses=1]
8 ret i32 %Z
9 }
10
+0
-3
test/Transforms/GCSE/dg.exp less more
None load_lib llvm.exp
1
2 RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
+0
-46
test/Transforms/GCSE/gcsetests.ll less more
None ; Various test cases to ensure basic functionality is working for GCSE
1
2 ; RUN: llvm-as < %s | opt -gcse
3
4 define void @testinsts(i32 %i, i32 %j, i32* %p) {
5 %A = bitcast i32 %i to i32 ; [#uses=0]
6 %B = bitcast i32 %i to i32 ; [#uses=0]
7 %C = shl i32 %i, 1 ; [#uses=0]
8 %D = shl i32 %i, 1 ; [#uses=0]
9 %E = getelementptr i32* %p, i64 12 ; [#uses=0]
10 %F = getelementptr i32* %p, i64 12 ; [#uses=0]
11 %G = getelementptr i32* %p, i64 13 ; [#uses=0]
12 ret void
13 }
14
15 ; Test different combinations of domination properties...
16 define void @sameBBtest(i32 %i, i32 %j) {
17 %A = add i32 %i, %j ; [#uses=1]
18 %B = add i32 %i, %j ; [#uses=1]
19 %C = xor i32 %A, -1 ; [#uses=0]
20 %D = xor i32 %B, -1 ; [#uses=0]
21 %E = xor i32 %j, -1 ; [#uses=0]
22 ret void
23 }
24
25 define i32 @dominates(i32 %i, i32 %j) {
26 %A = add i32 %i, %j ; [#uses=0]
27 br label %BB2
28
29 BB2: ; preds = %0
30 %B = add i32 %i, %j ; [#uses=1]
31 ret i32 %B
32 }
33
34 define i32 @hascommondominator(i32 %i, i32 %j) {
35 br i1 true, label %BB1, label %BB2
36
37 BB1: ; preds = %0
38 %A = add i32 %i, %j ; [#uses=1]
39 ret i32 %A
40
41 BB2: ; preds = %0
42 %B = add i32 %i, %j ; [#uses=1]
43 ret i32 %B
44 }
45
+0
-24
test/Transforms/GCSE/vectorops.ll less more
None ; RUN: llvm-as < %s | opt -gcse -instcombine | \
1 ; RUN: llvm-dis | not grep sub
2
3 define i32 @test_extractelement(<4 x i32> %V) {
4 %R = extractelement <4 x i32> %V, i32 1 ; [#uses=1]
5 %R2 = extractelement <4 x i32> %V, i32 1 ; [#uses=1]
6 %V.upgrd.1 = sub i32 %R, %R2 ; [#uses=1]
7 ret i32 %V.upgrd.1
8 }
9
10 define <4 x i32> @test_insertelement(<4 x i32> %V) {
11 %R = insertelement <4 x i32> %V, i32 0, i32 0 ; <<4 x i32>> [#uses=1]
12 %R2 = insertelement <4 x i32> %V, i32 0, i32 0 ; <<4 x i32>> [#uses=1]
13 %x = sub <4 x i32> %R, %R2 ; <<4 x i32>> [#uses=1]
14 ret <4 x i32> %x
15 }
16
17 define <4 x i32> @test_shufflevector(<4 x i32> %V) {
18 %R = shufflevector <4 x i32> %V, <4 x i32> %V, <4 x i32> < i32 1, i32 undef, i32 7, i32 2 > ; <<4 x i32>> [#uses=1]
19 %R2 = shufflevector <4 x i32> %V, <4 x i32> %V, <4 x i32> < i32 1, i32 undef, i32 7, i32 2 > ; <<4 x i32>> [#uses=1]
20 %x = sub <4 x i32> %R, %R2 ; <<4 x i32>> [#uses=1]
21 ret <4 x i32> %x
22 }
23
None ; RUN: llvm-as < %s | opt -instcombine -gcse -instcombine | \
0 ; RUN: llvm-as < %s | opt -instcombine -gvn -instcombine | \
11 ; RUN: llvm-dis | not grep getelementptr
22
33 define i1 @test(i32* %A) {
0 ; Test folding of constantexpr geps into normal geps.
1 ; RUN: llvm-as < %s | opt -instcombine -gcse -instcombine | \
1 ; RUN: llvm-as < %s | opt -instcombine -gvn -instcombine | \
22 ; RUN: llvm-dis | not grep getelementptr
33
44 @Array = external global [40 x i32] ; <[40 x i32]*> [#uses=2]
22 ; loaded from. Basically if the load gets hoisted, the subtract gets turned
33 ; into a constant zero.
44 ;
5 ; RUN: llvm-as < %s | opt -licm -load-vn -gcse -instcombine | llvm-dis | grep load
5 ; RUN: llvm-as < %s | opt -licm -gvn -instcombine | llvm-dis | grep load
66
77 @X = global i32 7 ; [#uses=2]
88
None ; RUN: llvm-as < %s | opt -reassociate -gcse | llvm-dis | grep add | count 6
0 ; RUN: llvm-as < %s | opt -reassociate -gvn | llvm-dis | grep add | count 6
11 ; Each of these functions should turn into two adds each.
22
33 @e = external global i32 ; [#uses=3]
None ; RUN: llvm-as < %s | opt -reassociate -gcse -instcombine | llvm-dis | not grep add
0 ; RUN: llvm-as < %s | opt -reassociate -gvn -instcombine | llvm-dis | not grep add
11
22 @a = weak global i32 0 ; [#uses=1]
33 @b = weak global i32 0 ; [#uses=1]
None ; RUN: llvm-as < %s | opt -load-vn -gcse -simplifycfg \
0 ; RUN: llvm-as < %s | opt -gvn -simplifycfg \
11 ; RUN: -disable-output
22 ; PR867
33 ; END.