llvm.org GIT mirror llvm / 9aafdcf
For PR1319: Upgrade to use new Tcl exec based test harness. This exposes 3 bugs that were previously not being reported: test/Transforms/GlobalDCE/2002-08-17-FunctionDGE.ll test/Transforms/GlobalOpt/memset.ll test/Transforms/IndVarsSimplify/exit_value_tests.llx git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36065 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Spencer 12 years ago
75 changed file(s) with 128 addition(s) and 98 deletion(s). Raw diff Collapse all Expand all
11 ; generated code should perform the appropriate masking operations required
22 ; depending on the endianness of the target...
33 ; XFAIL: *
4 ; RUN: llvm-upgrade < %s | llvm-as | opt -mem2reg | llvm-dis | not grep 'alloca'
4 ; RUN: llvm-upgrade < %s | llvm-as | opt -mem2reg | llvm-dis | \
5 ; RUN: not grep alloca
56
67 implementation
78
None load_lib llvm-dg.exp
0 load_lib llvm.exp
11
2 llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
2 RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
None load_lib llvm-dg.exp
0 load_lib llvm.exp
11
2 llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
2 RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
None load_lib llvm-dg.exp
0 load_lib llvm.exp
11
2 llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
2 RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
None ; RUN: llvm-upgrade < %s | llvm-as | opt -prune-eh | llvm-dis | not grep 'ret int'
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -prune-eh | llvm-dis | \
1 ; RUN: not grep {ret i32}
12
23 void %noreturn() {
34 unwind
None load_lib llvm-dg.exp
0 load_lib llvm.exp
11
2 llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
2 RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
None ; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -instcombine | llvm-dis | grep 'ret i32 0'
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -instcombine | llvm-dis |\
1 ; RUN: grep {ret i32 0}
12
23 int %f(int %a0, int %a1, int %a2, int %a3, int %a4) {
34 %tmp.2 = add int %a4, %a3 ; [#uses=1]
None load_lib llvm-dg.exp
0 load_lib llvm.exp
11
2 llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
2 RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
None ; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -instcombine | llvm-dis | not grep 'sub int 0'
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -instcombine | llvm-dis |\
1 ; RUN: not grep {sub i32 0}
12
23 int %test(int %X, int %Y, int %Z) {
34 %A = sub int 0, %X
0 ; With shl->mul reassociation, we can see that this is (shl A, 9) * A
11 ;
2 ; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -instcombine | llvm-dis | grep 'shl .*, 9'
2 ; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -instcombine | llvm-dis |\
3 ; RUN: grep {shl .*, 9}
34
45 int %test(int %A, int %B) {
56 %X = shl int %A, ubyte 5
11 ; this is in fact NOT the case, so the return should still be alive in the code
22 ; after sccp and CFG simplification have been performed.
33 ;
4 ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp -simplifycfg | llvm-dis | grep ret
4 ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp -simplifycfg | llvm-dis | \
5 ; RUN: grep ret
56
67
78 void "old_main"() {
None ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp | llvm-dis | not grep '%X'
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp | llvm-dis | not grep %X
11
22 %G = uninitialized global [40x int]
33
None ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp -simplifycfg | llvm-dis | not grep then:
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp -simplifycfg | llvm-dis | \
1 ; RUN: not grep then:
12
23 void %cprop_test11(int* %data.1) {
34 entry: ; No predecessors!
None ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp | llvm-dis | grep 'ret i32 1'
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp | llvm-dis | grep {ret i32 1}
11
22 ; This function definitely returns 1, even if we don't know the direction
33 ; of the branch.
11 ; SCCP ignores VectorTypes until PR 1034 is fixed
22 ;
33 ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp
4 ; END.
45 target datalayout = "E-p:32:32"
56 target endian = big
67 target pointersize = 32
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp | llvm-dis | \
1 ; RUN: grep 'ret i1 false'
1 ; RUN: grep {ret i1 false}
22
33 bool %foo() {
44 %X = and bool false, undef
None ; RUN: llvm-as < %s | opt -sccp | llvm-dis | grep 'ret i101 12'
0 ; RUN: llvm-as < %s | opt -sccp | llvm-dis | grep {ret i101 12}
11
22 @Y = constant [6 x i101] [ i101 12, i101 123456789000000, i101 -12,i101
33 -123456789000000, i101 0,i101 9123456789000000]
0 ; This is a basic sanity check for constant propogation. The add instruction
11 ; should be eliminated.
22
3 ; RUN: llvm-as < %s | opt -sccp | llvm-dis -o /dev/null -f &&
43 ; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep add
54
65 define i128 @test(i1 %B) {
0 ; This is a basic sanity check for constant propogation. The add instruction
11 ; and phi instruction should be eliminated.
22
3 ; RUN: llvm-as < %s | opt -sccp | llvm-dis -o /dev/null -f &&
43 ; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep phi
54 ; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep add
65
11 ; arithmatic operations.
22
33
4 ; RUN: llvm-as < %s | opt -sccp | llvm-dis -o /dev/null -f &&
54 ; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep mul
65 ; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep umod
76
1514 BB2:
1615 %f1 = udiv i128 -1, 1
1716 %f2 = add i128 %f1, 1
18 %f3 = umod i128 %f2, 2121
17 %f3 = urem i128 %f2, 2121
1918 br label %BB3
2019 BB3:
2120 %Ret = phi i128 [%t3, %BB1], [%f3, %BB2]
11 ; logic operations.
22
33
4 ; RUN: llvm-as < %s | opt -sccp | llvm-dis -o /dev/null -f &&
54 ; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep and
65 ; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep trunc
7 ; RUN: llvm-as < %s | opt -sccp | llvm-dis | grep "ret i100 -1"
6 ; RUN: llvm-as < %s | opt -sccp | llvm-dis | grep {ret i100 -1}
87
98 define i100 @test(i133 %A) {
109 %B = and i133 0, %A
None ; RUN: llvm-as < %s | opt -sccp | llvm-dis -o /dev/null -f &&
1 ; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep '%X'
0 ; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep %X
21
32 @G = global [1000000 x i10000] zeroinitializer
43
None ; RUN: llvm-as < %s | opt -sccp | llvm-dis -o /dev/null -f &&
1 ; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep xor
21
32 define i11129 @test1() {
None ; RUN: llvm-as < %s | opt -sccp | llvm-dis -o /dev/null -f &&
1 ; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep load
21
32 @Y = constant [6 x i101] [ i101 12, i101 123456789000000, i101 -12,
None ; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | grep -v 'ret i512 undef' | grep 'ret i8 2'
0 ; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | grep -v {ret i512 undef} | \
1 ; RUN: grep {ret i8 2}
12
23 define internal i512 @test(i1 %B) {
34 br i1 %B, label %BB1, label %BB2
None ; RUN: llvm-as < %s | opt -ipsccp | llvm-dis -o /dev/null -f &&
1 ; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | grep -v 'ret i101 0' | \
2 ; RUN: grep -v 'ret i101 undef' | not grep ret
3
0 ; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | grep -v {ret i101 0} | \
1 ; RUN: grep -v {ret i101 undef} | not grep ret
42
53
64 define internal i101 @bar(i101 %A) {
None ; RUN: llvm-as < %s | opt -ipsccp | llvm-dis -o /dev/null -f &&
1 ; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | not grep global
21
32 @G = internal global i66 undef
0 ; This test makes sure that these instructions are properly constant propagated.
1 ;
21
3 ; RUN: llvm-as < %s | opt -ipsccp | llvm-dis -o /dev/null -f &&
42 ; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | not grep load
53 ; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | not grep add
64 ; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | not grep phi
0 ; This test makes sure that these instructions are properly constant propagated.
1 ;
21
3 ; RUN: llvm-as < %s | opt -ipsccp | llvm-dis -o /dev/null -f &&
42 ; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | not grep load
53 ; RUN: llvm-as < %s | opt -ipsccp | llvm-dis | not grep fdiv
64
None ; RUN: llvm-as < %s | opt -sccp | llvm-dis -o /dev/null -f &&
1 ; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep phi
21
32 define i999 @test(i999%A, i1 %c) {
None ; RUN: llvm-as < %s | opt -sccp | llvm-dis -o /dev/null -f &&
1 ; RUN: llvm-as < %s | opt -sccp | llvm-dis | not grep select
21
32 @A = constant i32 10
None ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp -adce -simplifycfg | llvm-dis | not grep br
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp -adce -simplifycfg | llvm-dis | \
1 ; RUN: not grep br
12
23 ; No matter how hard you try, sqrt(1.0) is always 1.0. This allows the
34 ; optimizer to delete this loop.
None load_lib llvm-dg.exp
0 load_lib llvm.exp
11
2 llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
2 RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
None ; RUN: llvm-upgrade < %s | llvm-as | opt -ipsccp | llvm-dis | grep -v 'ret i32 17' | grep -v 'ret i32 undef' | not grep ret
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -ipsccp | llvm-dis | \
1 ; RUN: grep -v {ret i32 17} | grep -v {ret i32 undef} | not grep ret
12
23 implementation
34
None ; RUN: llvm-upgrade < %s | llvm-as | opt -ipsccp | llvm-dis | grep -v 'ret i32 0' | grep -v 'ret i32 undef' | not grep ret
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -ipsccp | llvm-dis | \
1 ; RUN: grep -v {ret i32 0} | grep -v {ret i32 undef} | not grep ret
12
23 implementation
34
None ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp | llvm-dis | grep 'ret i32 0'
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp | llvm-dis | grep {ret i32 0}
11
22 ; Test that SCCP has basic knowledge of when and/or nuke overdefined values.
33
None ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp -dce -simplifycfg | llvm-dis | not grep br
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp -dce -simplifycfg | llvm-dis | \
1 ; RUN: not grep br
12
23 int %test(int %param) {
34 entry:
0 ; This is the test case taken from appel's book that illustrates a hard case
11 ; that SCCP gets right. BB3 should be completely eliminated.
22 ;
3 ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp -constprop -dce -cfgsimplify | llvm-dis | not grep BB3
3 ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp -constprop -dce -simplifycfg | \
4 ; RUN: llvm-dis | not grep BB3
45
56 int %testfunction(int %i0, int %j0) {
67 BB1:
None ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp -disable-output &&
1 ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp | llvm-dis | not grep select
21
32 int %test1(bool %C) {
None ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | grep alloca | grep '4 x'
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | \
1 ; RUN: grep alloca | grep {4 x}
12
23 ; Test that an array is not incorrectly deconstructed...
34
0 ; Scalar replacement was incorrectly promoting this alloca!!
11 ;
2 ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | sed 's/;.*//g' | grep '\['
2 ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | \
3 ; RUN: sed {s/;.*//g} | grep \[
34
45 sbyte *%test() {
56 %A = alloca [30 x sbyte]
None ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | grep alloca | grep '{'
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | \
1 ; RUN: grep alloca | grep \{
12 implementation ; Functions:
23
34 declare int %.callback_1(sbyte*)
None ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis &&
1 ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | grep -F 'alloca [2 x <4 x i32>]'
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | \
1 ; RUN: grep -F {alloca \[2 x <4 x i32>\]}
22
33 int %func(<4 x float> %v0, <4 x float> %v1) {
44 %vsiidx = alloca [2 x <4 x int>], align 16 ; <[2 x <4 x int>]*> [#uses=3]
None load_lib llvm-dg.exp
0 load_lib llvm.exp
11
2 llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
2 RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
None ; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep 'call void @llvm.memcpy.i32' &&
1 ; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep 'getelementptr'
2 ; PR1226
1 ; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | \
2 ; RUN: not grep {call void @llvm.memcpy.i32}
3 ; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep getelementptr
4 ; END.
5
36 target datalayout = "E-p:32:32"
47 target triple = "powerpc-apple-darwin8.8.0"
58 %struct.foo = type { i8, i8 }
None ; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep 'ret i32 16843009' &&
0 ; PR1226
1 ; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep {ret i32 16843009}
12 ; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep alloca
2 ; PR1226
33
44 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
55 target triple = "i686-apple-darwin8"
None ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | not grep alloca &&
1 ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | grep 'bitcast.*float.*i32'
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | \
1 ; RUN: not grep alloca
2 ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | \
3 ; RUN: grep {bitcast.*float.*i32}
4
5 implementation
26
37 int %test(float %X) {
48 %X_addr = alloca float
None ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | not grep alloca &&
1 ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | grep 'bitcast'
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | \
1 ; RUN: not grep alloca
2 ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | \
3 ; RUN: grep bitcast
24
35 target endian = little
46
None ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | not grep alloca &&
1 ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | grep 'ret i8'
2
3 ; PR892
1 ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | \
2 ; RUN: not grep alloca
3 ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | grep {ret i8}
44
55 target endian = little
66 target pointersize = 32
0 ; Basic block #2 should not be merged into BB #3!
11 ;
2 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | grep 'br label'
2 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
3 ; RUN: grep {br label}
34 ;
45 declare void %foo()
56 implementation
0 ; This test checks to make sure that 'br X, Dest, Dest' is folded into
11 ; 'br Dest'
22
3 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep 'br bool %c2'
3 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
4 ; RUN: not grep {br bool %c2}
45
56 declare void %noop()
67
22 ; due to the fact that the SimplifyCFG function does not use
33 ; the ConstantFoldTerminator function.
44
5 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep 'br bool %c2'
5 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
6 ; RUN: not grep {br bool %c2}
67
78 declare void %noop()
89
None ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep switch
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
1 ; RUN: not grep switch
12
23 int %test1() { ; Test normal folding
34 switch uint 5, label %Default [
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -disable-output
1 ; END.
12
23 %arraytype.1.Char = type { int, [0 x sbyte] }
34 %arraytype.4.Signed = type { int, [0 x int] }
0 ; Make sure this doesn't turn into an infinite loop
11
2 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -constprop -simplifycfg | llvm-dis | grep bb86
2 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -constprop -simplifycfg |\
3 ; RUN: llvm-dis | grep bb86
4 ; END.
35
46 %struct.anon = type { uint, int, int, int, [1024 x sbyte] }
57 %_zero_ = external global %struct.anon* ; <%struct.anon**> [#uses=2]
None ; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse -simplifycfg -disable-output
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse -simplifycfg \
1 ; RUN: -disable-output
12 ; PR867
23
34 target endian = big
None ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -disable-output &&
1 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep select
2
3 ; PR957
1 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
2 ; RUN: not grep select
43
54 uint %test(uint %tmp) {
65 cond_false179: ; preds = %cond_true
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis
1 ; END.
12 ; ModuleID = 'bugpoint-tooptimize.bc'
23 target datalayout = "e-p:32:32"
34 target endian = little
None ;RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep 'br label'
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
1 ; RUN: not grep {br label}
2
13 void %test(bool %C) {
24 br bool %C, label %A, label %B
35 A:
None ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep 'icmp eq'
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
1 ; RUN: not grep {icmp eq}
12
23 ; Check that simplifycfg deletes a dead 'seteq' instruction when it
34 ; folds a conditional branch into a switch instruction.
0 ; Test merging of blocks with phi nodes.
11 ;
2 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep 'N:'
2 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep N:
33 ;
44
55 int %test(bool %a) {
22
33 ; If this test is successful, the function should be reduced to 'call; ret'
44
5 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not egrep 'invoke|br'
5 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
6 ; RUN: not egrep {\\(invoke\\)|\\(br\\)}
67
78 declare void %bar()
89
0 ; Test merging of blocks that only have PHI nodes in them
11 ;
2 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep 'N:'
2 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep N:
33 ;
44
55 int %test(bool %a, bool %b) {
11 ; where the mergedinto block doesn't have any PHI nodes, and is in fact
22 ; dominated by the block-to-be-eliminated
33 ;
4 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep 'N:'
4 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep N:
55 ;
66
77 int %test(bool %a, bool %b) {
33 ; 'if conversion'.
44
55 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis > %t.xform
6 ; RUN: not grep phi %t.xform && grep ret %t.xform
6 ; RUN: not grep phi %t.xform
7 ; RUN: grep ret %t.xform
78
89 declare void %use(bool)
910 declare void %use(int)
None ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep select
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
1 ; RUN: not grep select
12
23 ;; The PHI node in this example should not be turned into a select, as we are
34 ;; not able to ifcvt the entire block. As such, converting to a select just
11 ; a PHI node and a return. Make sure the simplify cfg can straighten out this
22 ; important case. This is basically the most trivial form of tail-duplication.
33
4 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep 'br label'
4 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
5 ; RUN: not grep {br label}
56
67 int %test(bool %B, int %A, int %B) {
78 br bool %B, label %T, label %F
None ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -instcombine -simplifycfg | llvm-dis | not grep call
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -instcombine \
1 ; RUN: -simplifycfg | llvm-dis | not grep call
12
23 declare void %bar()
34
None ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | grep 'br i1' | wc -l | grep 1
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | grep {br i1} | wc -l | grep 1
11
22 void %test(int* %P, int* %Q, bool %A, bool %B) {
33 br bool %A, label %a, label %b ;; fold the two branches into one
None ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -adce | llvm-dis | not grep 'call void %f1' &&
1 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -adce -disable-output
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -adce | llvm-dis | \
1 ; RUN: not grep {call void %f1}
2 ; END.
3
24 declare void %f1()
35 declare void %f2()
46 declare void %f3()
None load_lib llvm-dg.exp
0 load_lib llvm.exp
11
2 llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
2 RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]]
None ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep 'br'
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep br
11 declare void %bar(int)
22
33 void %test(bool %P, int* %Q) {
None ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep 'br'
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep br
1 ; END.
12
23 bool %_ZN4llvm11SetCondInst7classofEPKNS_11InstructionE({uint, uint}* %I) {
34 entry:
None ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | grep switch | wc -l | grep 1
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
1 ; RUN: grep switch | wc -l | grep 1
12
23 ; Test that a switch going to a switch on the same value can be merged. All
34 ; three switches in this example can be merged into one big one.
None ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep 'call void %DEAD'
0 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
1 ; RUN: not grep {call void %DEAD}
12
23 ; Test that we can thread a simple known condition through switch statements.
34