Remove GCSE and LoadVN from the testsuite.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54832 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2008-08-16 00:00:54 +00:00
parent 3688f268cb
commit 7c856c09cd
41 changed files with 25 additions and 308 deletions

View File

@ -1,15 +0,0 @@
; RUN: llvm-as < %s | opt -anders-aa -load-vn -gcse -deadargelim | llvm-dis | not grep ARG
@G = internal constant i32* null
define internal i32 @internal(i32* %ARG) {
;; The 'Arg' argument must-aliases the null pointer, so it can be subsituted
;; directly here, making it dead.
store i32* %ARG, i32** @G
ret i32 0
}
define i32 @foo() {
%V = call i32 @internal(i32* null)
ret i32 %V
}

View File

@ -1,4 +1,4 @@
; RUN: llvm-as < %s | opt -anders-aa -load-vn -gcse -deadargelim | llvm-dis | grep store | not grep null
; RUN: llvm-as < %s | opt -anders-aa -gvn -deadargelim | llvm-dis | grep store | not grep null
; Because the 'internal' function is passed to an external function, we don't
; know what the incoming values will alias. As such, we cannot do the

View File

@ -1,4 +1,4 @@
; RUN: llvm-as < %s | opt -anders-aa -load-vn -gcse -instcombine | llvm-dis \
; RUN: llvm-as < %s | opt -anders-aa -gvn -instcombine | llvm-dis \
; RUN: | grep {ret i1 true}
@G = internal global i32* null

View File

@ -2,7 +2,7 @@
; is performed. It is not legal to delete the second load instruction because
; the value computed by the first load instruction is changed by the store.
; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | llvm-dis | grep DONOTREMOVE
; RUN: llvm-as < %s | opt -gvn -instcombine | llvm-dis | grep DONOTREMOVE
define i32 @test() {
%A = alloca i32

View File

@ -1,4 +1,4 @@
; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | llvm-dis | grep sub
; RUN: llvm-as < %s | opt -gvn -instcombine | llvm-dis | grep sub
; BasicAA was incorrectly concluding that P1 and P2 didn't conflict!

View File

@ -1,6 +1,6 @@
; In this test, a local alloca cannot alias an incoming argument.
; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | llvm-dis | not grep sub
; RUN: llvm-as < %s | opt -gvn -instcombine | llvm-dis | not grep sub
define i32 @test(i32* %P) {
%X = alloca i32

View File

@ -1,13 +0,0 @@
; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | \
; RUN: llvm-dis | not grep load
@X = constant [2 x i32] [i32 4, i32 5]
define i32 @test(i32* %Y, i64 %idx) {
%P = getelementptr [2 x i32]* @X, i64 0, i64 %idx
%A = load i32* %P ; Load from invariant memory
store i32 4, i32* %Y ; Store could not be to @X
%B = load i32* %P
%C = sub i32 %A, %B
ret i32 %C
}

View File

@ -1,4 +1,4 @@
; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine |\
; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine |\
; RUN: llvm-dis | grep {load i32\\* %A}
declare double* @useit(i32*)

View File

@ -1,7 +1,7 @@
; PR1109
; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | \
; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine | llvm-dis | \
; RUN: grep {sub i32}
; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | \
; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine | llvm-dis | \
; RUN: not grep {ret i32 0}
; END.

View File

@ -1,5 +1,5 @@
; PR1600
; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | \
; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine | llvm-dis | \
; RUN: grep {ret i32 0}
; END.

View File

@ -1,7 +1,7 @@
; This testcase tests for various features the basicaa test should be able to
; determine, as noted in the comments.
; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine -dce | llvm-dis | not grep REMOVE
; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine -dce | llvm-dis | not grep REMOVE
@Global = external global { i32 }

View File

@ -2,7 +2,7 @@
; disambiguating some obvious cases. All loads should be removable in
; this testcase.
; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine -dce \
; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine -dce \
; RUN: | llvm-dis | not grep load
@A = global i32 7

View File

@ -1,7 +1,7 @@
; A store or load cannot alias a global if the accessed amount is larger then
; the global.
; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep load
; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine | llvm-dis | not grep load
@B = global i16 8 ; <i16*> [#uses=2]

View File

@ -1,4 +1,4 @@
; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine |\
; RUN: llvm-as < %s | opt -basicaa -gvn -instcombine |\
; RUN: llvm-dis | grep {ret i32 0}
declare void @foo(i32*)

View File

@ -1,4 +1,4 @@
; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load
; RUN: llvm-as < %s | opt -globalsmodref-aa -gvn | llvm-dis | not grep load
@X = internal global i32 4 ; <i32*> [#uses=1]
define i32 @test(i32* %P) {

View File

@ -1,4 +1,4 @@
; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load
; RUN: llvm-as < %s | opt -globalsmodref-aa -gvn | llvm-dis | not grep load
; This test requires the use of previous analyses to determine that
; doesnotmodX does not modify X (because 'sin' doesn't).

View File

@ -1,4 +1,4 @@
; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse -instcombine | llvm-dis | \
; RUN: llvm-as < %s | opt -globalsmodref-aa -gvn -instcombine | llvm-dis | \
; RUN: grep {ret i32 0}
@G = internal global i32* null ; <i32**> [#uses=3]

View File

@ -1,4 +1,4 @@
; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load
; RUN: llvm-as < %s | opt -globalsmodref-aa -gvn | llvm-dis | not grep load
@X = internal global i32 4 ; <i32*> [#uses=2]
define i32 @test(i32* %P) {

View File

@ -1,5 +1,5 @@
; Test that pure functions are cse'd away
; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse -instcombine | \
; RUN: llvm-as < %s | opt -globalsmodref-aa -gvn -instcombine | \
; RUN: llvm-dis | not grep sub
define i32 @pure(i32 %X) {

View File

@ -1,25 +0,0 @@
; This testcase ensures that redundant loads are eliminated when they should
; be. All RL variables (redundant loads) should be eliminated.
;
; RUN: llvm-as < %s | opt -load-vn -gcse | llvm-dis | not grep %RL
;
define i32 @test1(i32* %P) {
%A = load i32* %P ; <i32> [#uses=1]
%RL = load i32* %P ; <i32> [#uses=1]
%C = add i32 %A, %RL ; <i32> [#uses=1]
ret i32 %C
}
define i32 @test2(i32* %P) {
%A = load i32* %P ; <i32> [#uses=1]
br label %BB2
BB2: ; preds = %0
br label %BB3
BB3: ; preds = %BB2
%RL = load i32* %P ; <i32> [#uses=1]
%B = add i32 %A, %RL ; <i32> [#uses=1]
ret i32 %B
}

View File

@ -1,8 +0,0 @@
; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | llvm-dis | grep sub
define i32 @test(i32* %P) {
%X = volatile load i32* %P ; <i32> [#uses=1]
%Y = volatile load i32* %P ; <i32> [#uses=1]
%Z = sub i32 %X, %Y ; <i32> [#uses=1]
ret i32 %Z
}

View File

@ -1,26 +0,0 @@
; This testcase ensures that redundant loads are preserved when they are not
; allowed to be eliminated.
; RUN: llvm-as < %s | opt -load-vn -gcse | llvm-dis | grep sub
;
define i32 @test1(i32* %P) {
%A = load i32* %P ; <i32> [#uses=1]
store i32 1, i32* %P
%B = load i32* %P ; <i32> [#uses=1]
%C = sub i32 %A, %B ; <i32> [#uses=1]
ret i32 %C
}
define i32 @test2(i32* %P) {
%A = load i32* %P ; <i32> [#uses=1]
br label %BB2
BB2: ; preds = %0
store i32 5, i32* %P
br label %BB3
BB3: ; preds = %BB2
%B = load i32* %P ; <i32> [#uses=1]
%C = sub i32 %A, %B ; <i32> [#uses=1]
ret i32 %C
}

View File

@ -1,12 +0,0 @@
; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep sub
declare i32 @strlen(i8*) readonly
define i32 @test(i8* %P) {
%X = call i32 @strlen( i8* %P ) readonly ; <i32> [#uses=2]
%A = add i32 %X, 14 ; <i32> [#uses=1]
%Y = call i32 @strlen( i8* %P ) readonly ; <i32> [#uses=1]
%Z = sub i32 %X, %Y ; <i32> [#uses=1]
%B = add i32 %A, %Z ; <i32> [#uses=1]
ret i32 %B
}

View File

@ -1,14 +0,0 @@
; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep sub
declare i32 @strlen(i8*) readonly
declare void @use(i32)
define i8 @test(i8* %P, i8* %Q) {
%A = load i8* %Q ; <i8> [#uses=1]
%X = call i32 @strlen( i8* %P ) readonly ; <i32> [#uses=1]
%B = load i8* %Q ; <i8> [#uses=1]
call void @use( i32 %X )
%C = sub i8 %A, %B ; <i8> [#uses=1]
ret i8 %C
}

View File

@ -1,13 +0,0 @@
; Check to make sure that Value Numbering doesn't merge casts of different
; flavors.
; RUN: llvm-as < %s | opt -load-vn -gcse | llvm-dis | \
; RUN: grep {\[sz\]ext} | count 2
declare void @external(i32)
define i32 @test_casts(i16 %x) {
%a = sext i16 %x to i32 ; <i32> [#uses=1]
%b = zext i16 %x to i32 ; <i32> [#uses=1]
call void @external( i32 %a )
ret i32 %b
}

View File

@ -1,25 +0,0 @@
; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | \
; RUN: llvm-dis | not grep sub
%S = type { i32, i8 }
define i8 @test(i8** %P) {
%A = load i8** %P ; <i8*> [#uses=1]
%B = load i8* %A ; <i8> [#uses=1]
%X = load i8** %P ; <i8*> [#uses=1]
%Y = load i8* %X ; <i8> [#uses=1]
%R = sub i8 %B, %Y ; <i8> [#uses=1]
ret i8 %R
}
define i8 @test1(%S** %P) {
%A = load %S** %P ; <%S*> [#uses=1]
%B = getelementptr %S* %A, i32 0, i32 1 ; <i8*> [#uses=1]
%C = load i8* %B ; <i8> [#uses=1]
%X = load %S** %P ; <%S*> [#uses=1]
%Y = getelementptr %S* %X, i32 0, i32 1 ; <i8*> [#uses=1]
%Z = load i8* %Y ; <i8> [#uses=1]
%R = sub i8 %C, %Z ; <i8> [#uses=1]
ret i8 %R
}

View File

@ -1,3 +0,0 @@
load_lib llvm.exp
RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

View File

@ -1,14 +0,0 @@
; RUN: llvm-as < %s | opt -load-vn -gcse | llvm-dis | not grep load
; Test that loads of undefined memory are eliminated.
define i32 @test1() {
%X = malloc i32 ; <i32*> [#uses=1]
%Y = load i32* %X ; <i32> [#uses=1]
ret i32 %Y
}
define i32 @test2() {
%X = alloca i32 ; <i32*> [#uses=1]
%Y = load i32* %X ; <i32> [#uses=1]
ret i32 %Y
}

View File

@ -1,4 +1,4 @@
; RUN: llvm-as < %s | opt -domtree -gcse -domtree -constmerge -disable-output
; RUN: llvm-as < %s | opt -domtree -gvn -domtree -constmerge -disable-output
define i32 @test1() {
unreachable

View File

@ -1,17 +0,0 @@
; This entire chain of computation should be optimized away, but
; wasn't because the two multiplies were not detected as being identical.
;
; RUN: llvm-as < %s | opt -gcse -instcombine -dce | \
; RUN: llvm-dis | not grep sub
define i32 @vnum_test4(i32* %data) {
%idx1 = getelementptr i32* %data, i64 1 ; <i32*> [#uses=1]
%idx2 = getelementptr i32* %data, i64 3 ; <i32*> [#uses=1]
%reg1101 = load i32* %idx1 ; <i32> [#uses=2]
%reg1111 = load i32* %idx2 ; <i32> [#uses=2]
%reg109 = mul i32 %reg1101, %reg1111 ; <i32> [#uses=1]
%reg108 = mul i32 %reg1111, %reg1101 ; <i32> [#uses=1]
%reg121 = sub i32 %reg108, %reg109 ; <i32> [#uses=1]
ret i32 %reg121
}

View File

@ -1,14 +0,0 @@
; This testcase shows a bug where an common subexpression exists, but there
; is no shared dominator block that the expression can be hoisted out to.
;
; RUN: llvm-as < %s | opt -gcse | llvm-dis
define i32 @test(i32 %X, i32 %Y) {
%Z = add i32 %X, %Y ; <i32> [#uses=1]
ret i32 %Z
Unreachable: ; No predecessors!
%Q = add i32 %X, %Y ; <i32> [#uses=1]
ret i32 %Q
}

View File

@ -1,11 +0,0 @@
; This testcase shows a bug where an common subexpression exists, but there
; is no shared dominator block that the expression can be hoisted out to.
;
; RUN: llvm-as < %s | opt -load-vn -gcse | llvm-dis | not grep load
define i32 @test(i32* %P) {
store i32 5, i32* %P
%Z = load i32* %P ; <i32> [#uses=1]
ret i32 %Z
}

View File

@ -1,3 +0,0 @@
load_lib llvm.exp
RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]

View File

@ -1,46 +0,0 @@
; Various test cases to ensure basic functionality is working for GCSE
; RUN: llvm-as < %s | opt -gcse
define void @testinsts(i32 %i, i32 %j, i32* %p) {
%A = bitcast i32 %i to i32 ; <i32> [#uses=0]
%B = bitcast i32 %i to i32 ; <i32> [#uses=0]
%C = shl i32 %i, 1 ; <i32> [#uses=0]
%D = shl i32 %i, 1 ; <i32> [#uses=0]
%E = getelementptr i32* %p, i64 12 ; <i32*> [#uses=0]
%F = getelementptr i32* %p, i64 12 ; <i32*> [#uses=0]
%G = getelementptr i32* %p, i64 13 ; <i32*> [#uses=0]
ret void
}
; Test different combinations of domination properties...
define void @sameBBtest(i32 %i, i32 %j) {
%A = add i32 %i, %j ; <i32> [#uses=1]
%B = add i32 %i, %j ; <i32> [#uses=1]
%C = xor i32 %A, -1 ; <i32> [#uses=0]
%D = xor i32 %B, -1 ; <i32> [#uses=0]
%E = xor i32 %j, -1 ; <i32> [#uses=0]
ret void
}
define i32 @dominates(i32 %i, i32 %j) {
%A = add i32 %i, %j ; <i32> [#uses=0]
br label %BB2
BB2: ; preds = %0
%B = add i32 %i, %j ; <i32> [#uses=1]
ret i32 %B
}
define i32 @hascommondominator(i32 %i, i32 %j) {
br i1 true, label %BB1, label %BB2
BB1: ; preds = %0
%A = add i32 %i, %j ; <i32> [#uses=1]
ret i32 %A
BB2: ; preds = %0
%B = add i32 %i, %j ; <i32> [#uses=1]
ret i32 %B
}

View File

@ -1,24 +0,0 @@
; RUN: llvm-as < %s | opt -gcse -instcombine | \
; RUN: llvm-dis | not grep sub
define i32 @test_extractelement(<4 x i32> %V) {
%R = extractelement <4 x i32> %V, i32 1 ; <i32> [#uses=1]
%R2 = extractelement <4 x i32> %V, i32 1 ; <i32> [#uses=1]
%V.upgrd.1 = sub i32 %R, %R2 ; <i32> [#uses=1]
ret i32 %V.upgrd.1
}
define <4 x i32> @test_insertelement(<4 x i32> %V) {
%R = insertelement <4 x i32> %V, i32 0, i32 0 ; <<4 x i32>> [#uses=1]
%R2 = insertelement <4 x i32> %V, i32 0, i32 0 ; <<4 x i32>> [#uses=1]
%x = sub <4 x i32> %R, %R2 ; <<4 x i32>> [#uses=1]
ret <4 x i32> %x
}
define <4 x i32> @test_shufflevector(<4 x i32> %V) {
%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]
%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]
%x = sub <4 x i32> %R, %R2 ; <<4 x i32>> [#uses=1]
ret <4 x i32> %x
}

View File

@ -1,4 +1,4 @@
; RUN: llvm-as < %s | opt -instcombine -gcse -instcombine | \
; RUN: llvm-as < %s | opt -instcombine -gvn -instcombine | \
; RUN: llvm-dis | not grep getelementptr
define i1 @test(i32* %A) {

View File

@ -1,5 +1,5 @@
; Test folding of constantexpr geps into normal geps.
; RUN: llvm-as < %s | opt -instcombine -gcse -instcombine | \
; RUN: llvm-as < %s | opt -instcombine -gvn -instcombine | \
; RUN: llvm-dis | not grep getelementptr
@Array = external global [40 x i32] ; <[40 x i32]*> [#uses=2]

View File

@ -3,7 +3,7 @@
; loaded from. Basically if the load gets hoisted, the subtract gets turned
; into a constant zero.
;
; RUN: llvm-as < %s | opt -licm -load-vn -gcse -instcombine | llvm-dis | grep load
; RUN: llvm-as < %s | opt -licm -gvn -instcombine | llvm-dis | grep load
@X = global i32 7 ; <i32*> [#uses=2]

View File

@ -1,4 +1,4 @@
; RUN: llvm-as < %s | opt -reassociate -gcse | llvm-dis | grep add | count 6
; RUN: llvm-as < %s | opt -reassociate -gvn | llvm-dis | grep add | count 6
; Each of these functions should turn into two adds each.
@e = external global i32 ; <i32*> [#uses=3]

View File

@ -1,4 +1,4 @@
; RUN: llvm-as < %s | opt -reassociate -gcse -instcombine | llvm-dis | not grep add
; RUN: llvm-as < %s | opt -reassociate -gvn -instcombine | llvm-dis | not grep add
@a = weak global i32 0 ; <i32*> [#uses=1]
@b = weak global i32 0 ; <i32*> [#uses=1]

View File

@ -1,4 +1,4 @@
; RUN: llvm-as < %s | opt -load-vn -gcse -simplifycfg \
; RUN: llvm-as < %s | opt -gvn -simplifycfg \
; RUN: -disable-output
; PR867
; END.