aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTanya Lattner <tonic@nondot.org>2008-03-18 03:45:45 +0000
committerTanya Lattner <tonic@nondot.org>2008-03-18 03:45:45 +0000
commitf04d8d1593d0eedf5b9deaab48462dd88fefab93 (patch)
tree0cbf561bbe8c905283770e5ae2317f5f7367512c
parente856685710706e580a3ece2c59ced2cdf0719f55 (diff)
downloadexternal_llvm-f04d8d1593d0eedf5b9deaab48462dd88fefab93.zip
external_llvm-f04d8d1593d0eedf5b9deaab48462dd88fefab93.tar.gz
external_llvm-f04d8d1593d0eedf5b9deaab48462dd88fefab93.tar.bz2
Upgrade tests to not use llvm-upgrade.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48483 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/Transforms/InstCombine/div.ll97
-rw-r--r--test/Transforms/InstCombine/memmove.ll20
-rw-r--r--test/Transforms/InstCombine/mul.ll98
-rw-r--r--test/Transforms/SimplifyCFG/BrUnwind.ll23
-rw-r--r--test/Transforms/SimplifyCFG/DeadSetCC.ll37
-rw-r--r--test/Transforms/SimplifyCFG/EqualPHIEdgeBlockMerge.ll20
-rw-r--r--test/Transforms/SimplifyCFG/HoistCode.ll18
-rw-r--r--test/Transforms/SimplifyCFG/InvokeEliminate.ll18
-rw-r--r--test/Transforms/SimplifyCFG/PhiBlockMerge.ll33
-rw-r--r--test/Transforms/SimplifyCFG/PhiEliminate.ll53
-rw-r--r--test/Transforms/SimplifyCFG/PhiEliminate2.ll19
-rw-r--r--test/Transforms/SimplifyCFG/PhiNoEliminate.ll37
-rw-r--r--test/Transforms/SimplifyCFG/UncondBranchToReturn.ll42
-rw-r--r--test/Transforms/SimplifyCFG/UnreachableEliminate.ll50
-rw-r--r--test/Transforms/SimplifyCFG/basictest.ll29
-rw-r--r--test/Transforms/SimplifyCFG/branch-cond-merge.ll27
-rw-r--r--test/Transforms/SimplifyCFG/branch-cond-prop.ll21
-rw-r--r--test/Transforms/SimplifyCFG/branch-fold-test.ll21
-rw-r--r--test/Transforms/SimplifyCFG/branch-fold.ll21
-rw-r--r--test/Transforms/SimplifyCFG/branch-phi-thread.ll105
-rw-r--r--test/Transforms/SimplifyCFG/hoist-common-code.ll29
-rw-r--r--test/Transforms/SimplifyCFG/return-merge.ll27
-rw-r--r--test/Transforms/SimplifyCFG/switch-simplify-crash.ll117
-rw-r--r--test/Transforms/SimplifyCFG/switch_create.ll81
-rw-r--r--test/Transforms/SimplifyCFG/switch_formation.ll60
-rw-r--r--test/Transforms/SimplifyCFG/switch_switch_fold.ll66
26 files changed, 564 insertions, 605 deletions
diff --git a/test/Transforms/InstCombine/div.ll b/test/Transforms/InstCombine/div.ll
index 97f331c..b21d39b 100644
--- a/test/Transforms/InstCombine/div.ll
+++ b/test/Transforms/InstCombine/div.ll
@@ -1,69 +1,74 @@
; This test makes sure that div instructions are properly eliminated.
;
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep div
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep div
; END.
-implementation
-
-int %test1(int %A) {
- %B = div int %A, 1
- ret int %B
+define i32 @test1(i32 %A) {
+ %B = sdiv i32 %A, 1 ; <i32> [#uses=1]
+ ret i32 %B
}
-uint %test2(uint %A) {
- %B = div uint %A, 8 ; => Shift
- ret uint %B
+define i32 @test2(i32 %A) {
+ ; => Shift
+ %B = udiv i32 %A, 8 ; <i32> [#uses=1]
+ ret i32 %B
}
-int %test3(int %A) {
- %B = div int 0, %A ; => 0, don't need to keep traps
- ret int %B
+define i32 @test3(i32 %A) {
+ ; => 0, don't need to keep traps
+ %B = sdiv i32 0, %A ; <i32> [#uses=1]
+ ret i32 %B
}
-int %test4(int %A) {
- %B = div int %A, -1 ; 0-A
- ret int %B
+define i32 @test4(i32 %A) {
+ ; 0-A
+ %B = sdiv i32 %A, -1 ; <i32> [#uses=1]
+ ret i32 %B
}
-uint %test5(uint %A) {
- %B = div uint %A, 4294967280
- %C = div uint %B, 4294967292
- ret uint %C
+define i32 @test5(i32 %A) {
+ %B = udiv i32 %A, -16 ; <i32> [#uses=1]
+ %C = udiv i32 %B, -4 ; <i32> [#uses=1]
+ ret i32 %C
}
-bool %test6(uint %A) {
- %B = div uint %A, 123
- %C = seteq uint %B, 0 ; A < 123
- ret bool %C
-}
+define i1 @test6(i32 %A) {
+ %B = udiv i32 %A, 123 ; <i32> [#uses=1]
+ ; A < 123
+ %C = icmp eq i32 %B, 0 ; <i1> [#uses=1]
+ ret i1 %C
+}
-bool %test7(uint %A) {
- %B = div uint %A, 10
- %C = seteq uint %B, 2 ; A >= 20 && A < 30
- ret bool %C
+define i1 @test7(i32 %A) {
+ %B = udiv i32 %A, 10 ; <i32> [#uses=1]
+ ; A >= 20 && A < 30
+ %C = icmp eq i32 %B, 2 ; <i1> [#uses=1]
+ ret i1 %C
}
-bool %test8(ubyte %A) {
- %B = div ubyte %A, 123
- %C = seteq ubyte %B, 2 ; A >= 246
- ret bool %C
-}
+define i1 @test8(i8 %A) {
+ %B = udiv i8 %A, 123 ; <i8> [#uses=1]
+ ; A >= 246
+ %C = icmp eq i8 %B, 2 ; <i1> [#uses=1]
+ ret i1 %C
+}
-bool %test9(ubyte %A) {
- %B = div ubyte %A, 123
- %C = setne ubyte %B, 2 ; A < 246
- ret bool %C
-}
+define i1 @test9(i8 %A) {
+ %B = udiv i8 %A, 123 ; <i8> [#uses=1]
+ ; A < 246
+ %C = icmp ne i8 %B, 2 ; <i1> [#uses=1]
+ ret i1 %C
+}
-uint %test10(uint %X, bool %C) {
- %V = select bool %C, uint 64, uint 8
- %R = udiv uint %X, %V
- ret uint %R
+define i32 @test10(i32 %X, i1 %C) {
+ %V = select i1 %C, i32 64, i32 8 ; <i32> [#uses=1]
+ %R = udiv i32 %X, %V ; <i32> [#uses=1]
+ ret i32 %R
}
-int %test11(int %X, bool %C) {
- %A = select bool %C, int 1024, int 32
- %B = udiv int %X, %A
- ret int %B
+define i32 @test11(i32 %X, i1 %C) {
+ %A = select i1 %C, i32 1024, i32 32 ; <i32> [#uses=1]
+ %B = udiv i32 %X, %A ; <i32> [#uses=1]
+ ret i32 %B
}
diff --git a/test/Transforms/InstCombine/memmove.ll b/test/Transforms/InstCombine/memmove.ll
index 52ed592..66ed174 100644
--- a/test/Transforms/InstCombine/memmove.ll
+++ b/test/Transforms/InstCombine/memmove.ll
@@ -1,23 +1,19 @@
; This test makes sure that memmove instructions are properly eliminated.
;
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
; RUN: not grep {call void @llvm.memmove}
-%S = internal constant [33 x sbyte] c"panic: restorelist inconsistency\00"
+@S = internal constant [33 x i8] c"panic: restorelist inconsistency\00" ; <[33 x i8]*> [#uses=1]
-implementation
+declare void @llvm.memmove.i32(i8*, i8*, i32, i32)
-declare void %llvm.memmove.i32(sbyte*, sbyte*, uint, uint)
-
-void %test1(sbyte* %A, sbyte* %B, uint %N) {
- ;; 0 bytes -> noop.
- call void %llvm.memmove.i32(sbyte* %A, sbyte* %B, uint 0, uint 1)
+define void @test1(i8* %A, i8* %B, i32 %N) {
+ call void @llvm.memmove.i32( i8* %A, i8* %B, i32 0, i32 1 )
ret void
}
-void %test2(sbyte *%A, uint %N) {
- ;; dest can't alias source since we can't write to source!
- call void %llvm.memmove.i32(sbyte* %A, sbyte* getelementptr ([33 x sbyte]* %S, int 0, int 0),
- uint %N, uint 1)
+define void @test2(i8* %A, i32 %N) {
+ ;; dest can't alias source since we can't write to source!
+ call void @llvm.memmove.i32( i8* %A, i8* getelementptr ([33 x i8]* @S, i32 0, i32 0), i32 %N, i32 1 )
ret void
}
diff --git a/test/Transforms/InstCombine/mul.ll b/test/Transforms/InstCombine/mul.ll
index 1d5c286..8e9ab8d 100644
--- a/test/Transforms/InstCombine/mul.ll
+++ b/test/Transforms/InstCombine/mul.ll
@@ -1,74 +1,80 @@
; This test makes sure that mul instructions are properly eliminated.
;
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep mul
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep mul
; END.
-implementation
-
-int %test1(int %A) {
- %B = mul int %A, 1
- ret int %B
+define i32 @test1(i32 %A) {
+ %B = mul i32 %A, 1 ; <i32> [#uses=1]
+ ret i32 %B
}
-int %test2(int %A) {
- %B = mul int %A, 2 ; Should convert to an add instruction
- ret int %B
+define i32 @test2(i32 %A) {
+ ; Should convert to an add instruction
+ %B = mul i32 %A, 2 ; <i32> [#uses=1]
+ ret i32 %B
}
-int %test3(int %A) {
- %B = mul int %A, 0 ; This should disappear entirely
- ret int %B
+define i32 @test3(i32 %A) {
+ ; This should disappear entirely
+ %B = mul i32 %A, 0 ; <i32> [#uses=1]
+ ret i32 %B
}
-double %test4(double %A) {
- %B = mul double 1.0, %A ; This is safe for FP
- ret double %B
+define double @test4(double %A) {
+ ; This is safe for FP
+ %B = mul double 1.000000e+00, %A ; <double> [#uses=1]
+ ret double %B
}
-int %test5(int %A) {
- %B = mul int %A, 8
- ret int %B
+define i32 @test5(i32 %A) {
+ %B = mul i32 %A, 8 ; <i32> [#uses=1]
+ ret i32 %B
}
-ubyte %test6(ubyte %A) {
- %B = mul ubyte %A, 8
- %C = mul ubyte %B, 8
- ret ubyte %C
+define i8 @test6(i8 %A) {
+ %B = mul i8 %A, 8 ; <i8> [#uses=1]
+ %C = mul i8 %B, 8 ; <i8> [#uses=1]
+ ret i8 %C
}
-int %test7(int %i) {
- %tmp = mul int %i, -1 ; %tmp = sub 0, %i
- ret int %tmp
+define i32 @test7(i32 %i) {
+ %tmp = mul i32 %i, -1 ; <i32> [#uses=1]
+ ret i32 %tmp
}
-ulong %test8(ulong %i) {
- %j = mul ulong %i, 18446744073709551615 ; tmp = sub 0, %i
- ret ulong %j
+define i64 @test8(i64 %i) {
+ ; tmp = sub 0, %i
+ %j = mul i64 %i, -1 ; <i64> [#uses=1]
+ ret i64 %j
}
-uint %test9(uint %i) {
- %j = mul uint %i, 4294967295 ; %j = sub 0, %i
- ret uint %j
+define i32 @test9(i32 %i) {
+ ; %j = sub 0, %i
+ %j = mul i32 %i, -1 ; <i32> [#uses=1]
+ ret i32 %j
}
-uint %test10(int %a, uint %b) {
- %c = setlt int %a, 0
- %d = cast bool %c to uint
- %e = mul uint %d, %b ; e = b & (a >> 31)
- ret uint %e
+define i32 @test10(i32 %a, i32 %b) {
+ %c = icmp slt i32 %a, 0 ; <i1> [#uses=1]
+ %d = zext i1 %c to i32 ; <i32> [#uses=1]
+ ; e = b & (a >> 31)
+ %e = mul i32 %d, %b ; <i32> [#uses=1]
+ ret i32 %e
}
-uint %test11(int %a, uint %b) {
- %c = setle int %a, -1
- %d = cast bool %c to uint
- %e = mul uint %d, %b ; e = b & (a >> 31)
- ret uint %e
+define i32 @test11(i32 %a, i32 %b) {
+ %c = icmp sle i32 %a, -1 ; <i1> [#uses=1]
+ %d = zext i1 %c to i32 ; <i32> [#uses=1]
+ ; e = b & (a >> 31)
+ %e = mul i32 %d, %b ; <i32> [#uses=1]
+ ret i32 %e
}
-uint %test12(ubyte %a, uint %b) {
- %c = setgt ubyte %a, 127
- %d = cast bool %c to uint
- %e = mul uint %d, %b ; e = b & (a >> 31)
- ret uint %e
+define i32 @test12(i8 %a, i32 %b) {
+ %c = icmp ugt i8 %a, 127 ; <i1> [#uses=1]
+ %d = zext i1 %c to i32 ; <i32> [#uses=1]
+ ; e = b & (a >> 31)
+ %e = mul i32 %d, %b ; <i32> [#uses=1]
+ ret i32 %e
}
diff --git a/test/Transforms/SimplifyCFG/BrUnwind.ll b/test/Transforms/SimplifyCFG/BrUnwind.ll
index 73bd975..1acdecd 100644
--- a/test/Transforms/SimplifyCFG/BrUnwind.ll
+++ b/test/Transforms/SimplifyCFG/BrUnwind.ll
@@ -1,14 +1,15 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
; RUN: not grep {br label}
-void %test(bool %C) {
- br bool %C, label %A, label %B
-A:
- call void %test(bool %C)
- br label %X
-B:
- call void %test(bool %C)
- br label %X
-X:
- unwind
+define void @test(i1 %C) {
+ br i1 %C, label %A, label %B
+A: ; preds = %0
+ call void @test( i1 %C )
+ br label %X
+B: ; preds = %0
+ call void @test( i1 %C )
+ br label %X
+X: ; preds = %B, %A
+ unwind
}
+
diff --git a/test/Transforms/SimplifyCFG/DeadSetCC.ll b/test/Transforms/SimplifyCFG/DeadSetCC.ll
index ea215e3..a4c8366 100644
--- a/test/Transforms/SimplifyCFG/DeadSetCC.ll
+++ b/test/Transforms/SimplifyCFG/DeadSetCC.ll
@@ -1,27 +1,28 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
; RUN: not grep {icmp eq}
; Check that simplifycfg deletes a dead 'seteq' instruction when it
; folds a conditional branch into a switch instruction.
-declare void %foo()
-declare void %bar()
+declare void @foo()
-void %testcfg(uint %V) {
- %C = seteq uint %V, 18
- %D = seteq uint %V, 180
- %E = or bool %C, %D
- br bool %E, label %L1, label %Sw
-Sw:
- switch uint %V, label %L1 [
- uint 15, label %L2
- uint 16, label %L2
+declare void @bar()
+
+define void @testcfg(i32 %V) {
+ %C = icmp eq i32 %V, 18 ; <i1> [#uses=1]
+ %D = icmp eq i32 %V, 180 ; <i1> [#uses=1]
+ %E = or i1 %C, %D ; <i1> [#uses=1]
+ br i1 %E, label %L1, label %Sw
+Sw: ; preds = %0
+ switch i32 %V, label %L1 [
+ i32 15, label %L2
+ i32 16, label %L2
]
-L1:
- call void %foo()
- ret void
-L2:
- call void %bar()
- ret void
+L1: ; preds = %Sw, %0
+ call void @foo( )
+ ret void
+L2: ; preds = %Sw, %Sw
+ call void @bar( )
+ ret void
}
diff --git a/test/Transforms/SimplifyCFG/EqualPHIEdgeBlockMerge.ll b/test/Transforms/SimplifyCFG/EqualPHIEdgeBlockMerge.ll
index 3c1f141..55db788 100644
--- a/test/Transforms/SimplifyCFG/EqualPHIEdgeBlockMerge.ll
+++ b/test/Transforms/SimplifyCFG/EqualPHIEdgeBlockMerge.ll
@@ -1,18 +1,18 @@
; Test merging of blocks with phi nodes.
;
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep N:
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep N:
;
-int %test(bool %a) {
+define i32 @test(i1 %a) {
Q:
- br bool %a, label %N, label %M
-N:
- br label %M
-M:
- ; It's ok to merge N and M because the incoming values for W are the
+ br i1 %a, label %N, label %M
+N: ; preds = %Q
+ br label %M
+M: ; preds = %N, %Q
+ ; It's ok to merge N and M because the incoming values for W are the
; same for both cases...
- %W = phi int [2, %N], [2, %Q]
- %R = add int %W, 1
- ret int %R
+ %W = phi i32 [ 2, %N ], [ 2, %Q ] ; <i32> [#uses=1]
+ %R = add i32 %W, 1 ; <i32> [#uses=1]
+ ret i32 %R
}
diff --git a/test/Transforms/SimplifyCFG/HoistCode.ll b/test/Transforms/SimplifyCFG/HoistCode.ll
index b817477..d8894a6 100644
--- a/test/Transforms/SimplifyCFG/HoistCode.ll
+++ b/test/Transforms/SimplifyCFG/HoistCode.ll
@@ -1,11 +1,11 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep br
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
-void %foo(bool %C, int* %P) {
- br bool %C, label %T, label %F
-T:
- store int 7, int* %P
- ret void
-F:
- store int 7, int* %P
- ret void
+define void @foo(i1 %C, i32* %P) {
+ br i1 %C, label %T, label %F
+T: ; preds = %0
+ store i32 7, i32* %P
+ ret void
+F: ; preds = %0
+ store i32 7, i32* %P
+ ret void
}
diff --git a/test/Transforms/SimplifyCFG/InvokeEliminate.ll b/test/Transforms/SimplifyCFG/InvokeEliminate.ll
index 89d76a8..4f52f6b 100644
--- a/test/Transforms/SimplifyCFG/InvokeEliminate.ll
+++ b/test/Transforms/SimplifyCFG/InvokeEliminate.ll
@@ -3,16 +3,16 @@
; If this test is successful, the function should be reduced to 'call; ret'
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
; RUN: not egrep {\\(invoke\\)|\\(br\\)}
-declare void %bar()
+declare void @bar()
-int %test() {
- invoke void %bar() to label %Ok except label %Rethrow
-Ok:
- ret int 0
-Rethrow:
- unwind
+define i32 @test() {
+ invoke void @bar( )
+ to label %Ok unwind label %Rethrow
+Ok: ; preds = %0
+ ret i32 0
+Rethrow: ; preds = %0
+ unwind
}
-
diff --git a/test/Transforms/SimplifyCFG/PhiBlockMerge.ll b/test/Transforms/SimplifyCFG/PhiBlockMerge.ll
index 7b24426..f3844f7 100644
--- a/test/Transforms/SimplifyCFG/PhiBlockMerge.ll
+++ b/test/Transforms/SimplifyCFG/PhiBlockMerge.ll
@@ -1,23 +1,22 @@
; Test merging of blocks that only have PHI nodes in them
;
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep N:
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep N:
;
-int %test(bool %a, bool %b) {
- br bool %a, label %M, label %O
-
-O:
- br bool %b, label %N, label %Q
-Q:
- br label %N
-N:
- %Wp = phi int [0, %O], [1, %Q]
- ; This block should be foldable into M
- br label %M
-
-M:
- %W = phi int [%Wp, %N], [2, %0]
- %R = add int %W, 1
- ret int %R
+define i32 @test(i1 %a, i1 %b) {
+; <label>:0
+ br i1 %a, label %M, label %O
+O: ; preds = %0
+ br i1 %b, label %N, label %Q
+Q: ; preds = %O
+ br label %N
+N: ; preds = %Q, %O
+ ; This block should be foldable into M
+ %Wp = phi i32 [ 0, %O ], [ 1, %Q ] ; <i32> [#uses=1]
+ br label %M
+M: ; preds = %N, %0
+ %W = phi i32 [ %Wp, %N ], [ 2, %0 ] ; <i32> [#uses=1]
+ %R = add i32 %W, 1 ; <i32> [#uses=1]
+ ret i32 %R
}
diff --git a/test/Transforms/SimplifyCFG/PhiEliminate.ll b/test/Transforms/SimplifyCFG/PhiEliminate.ll
index ef2433c..94697c9 100644
--- a/test/Transforms/SimplifyCFG/PhiEliminate.ll
+++ b/test/Transforms/SimplifyCFG/PhiEliminate.ll
@@ -3,36 +3,39 @@
; nodes away allows the branches to be eliminated, performing a simple form of
; 'if conversion'.
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis > %t.xform
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis > %t.xform
; RUN: not grep phi %t.xform
; RUN: grep ret %t.xform
-declare void %use(bool)
-declare void %use(int)
+declare void @use(i1)
+declare void @use.upgrd.1(i32)
-void %test2(bool %c, bool %d, int %V, int %V2) {
- br bool %d, label %X, label %F
-X:
- br bool %c, label %T, label %F
-T:
- br label %F
-F:
- %B1 = phi bool [true, %0], [false, %T], [false, %X]
- %I7 = phi int [%V, %0], [%V2, %T], [%V2, %X]
- call void %use(bool %B1)
- call void %use(int %I7)
- ret void
+define void @test2(i1 %c, i1 %d, i32 %V, i32 %V2) {
+; <label>:0
+ br i1 %d, label %X, label %F
+X: ; preds = %0
+ br i1 %c, label %T, label %F
+T: ; preds = %X
+ br label %F
+F: ; preds = %T, %X, %0
+ %B1 = phi i1 [ true, %0 ], [ false, %T ], [ false, %X ] ; <i1> [#uses=1]
+ %I7 = phi i32 [ %V, %0 ], [ %V2, %T ], [ %V2, %X ] ; <i32> [#uses=1]
+ call void @use( i1 %B1 )
+ call void @use.upgrd.1( i32 %I7 )
+ ret void
}
-void %test(bool %c, int %V, int %V2) {
- br bool %c, label %T, label %F
-T:
- br label %F
-F:
- %B1 = phi bool [true, %0], [false, %T]
- %I6 = phi int [%V, %0], [0, %T]
- call void %use(bool %B1)
- call void %use(int %I6)
- ret void
+define void @test(i1 %c, i32 %V, i32 %V2) {
+; <label>:0
+ br i1 %c, label %T, label %F
+T: ; preds = %0
+ br label %F
+F: ; preds = %T, %0
+ %B1 = phi i1 [ true, %0 ], [ false, %T ] ; <i1> [#uses=1]
+ %I6 = phi i32 [ %V, %0 ], [ 0, %T ] ; <i32> [#uses=1]
+ call void @use( i1 %B1 )
+ call void @use.upgrd.1( i32 %I6 )
+ ret void
}
+
diff --git a/test/Transforms/SimplifyCFG/PhiEliminate2.ll b/test/Transforms/SimplifyCFG/PhiEliminate2.ll
index fb00a13..ec1b91a 100644
--- a/test/Transforms/SimplifyCFG/PhiEliminate2.ll
+++ b/test/Transforms/SimplifyCFG/PhiEliminate2.ll
@@ -1,15 +1,14 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep br
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
-int %test(bool %C, int %V1, int %V2) {
+define i32 @test(i1 %C, i32 %V1, i32 %V2) {
entry:
- br bool %C, label %then, label %Cont
-
-then:
- %V3 = or int %V2, %V1
+ br i1 %C, label %then, label %Cont
+then: ; preds = %entry
+ %V3 = or i32 %V2, %V1 ; <i32> [#uses=1]
br label %Cont
-Cont:
- %V4 = phi int [%V1, %entry], [%V3, %then]
- call int %test(bool false, int 0, int 0) ;; don't fold into preds
- ret int %V1
+Cont: ; preds = %then, %entry
+ %V4 = phi i32 [ %V1, %entry ], [ %V3, %then ] ; <i32> [#uses=0]
+ call i32 @test( i1 false, i32 0, i32 0 ) ; <i32>:0 [#uses=0]
+ ret i32 %V1
}
diff --git a/test/Transforms/SimplifyCFG/PhiNoEliminate.ll b/test/Transforms/SimplifyCFG/PhiNoEliminate.ll
index 4535541..dfe122a 100644
--- a/test/Transforms/SimplifyCFG/PhiNoEliminate.ll
+++ b/test/Transforms/SimplifyCFG/PhiNoEliminate.ll
@@ -1,30 +1,27 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
; RUN: not grep select
;; The PHI node in this example should not be turned into a select, as we are
;; not able to ifcvt the entire block. As such, converting to a select just
;; introduces inefficiency without saving copies.
-int %bar(bool %C) {
+define i32 @bar(i1 %C) {
entry:
- br bool %C, label %then, label %endif
-
-then:
- %tmp.3 = call int %qux()
+ br i1 %C, label %then, label %endif
+then: ; preds = %entry
+ %tmp.3 = call i32 @qux( ) ; <i32> [#uses=0]
br label %endif
-
-endif:
- %R = phi int [123, %entry], [12312, %then]
- ;; stuff to disable tail duplication
- call int %qux()
- call int %qux()
- call int %qux()
- call int %qux()
- call int %qux()
- call int %qux()
- call int %qux()
- ret int %R
+endif: ; preds = %then, %entry
+ %R = phi i32 [ 123, %entry ], [ 12312, %then ] ; <i32> [#uses=1]
+ ;; stuff to disable tail duplication
+ call i32 @qux( ) ; <i32>:0 [#uses=0]
+ call i32 @qux( ) ; <i32>:1 [#uses=0]
+ call i32 @qux( ) ; <i32>:2 [#uses=0]
+ call i32 @qux( ) ; <i32>:3 [#uses=0]
+ call i32 @qux( ) ; <i32>:4 [#uses=0]
+ call i32 @qux( ) ; <i32>:5 [#uses=0]
+ call i32 @qux( ) ; <i32>:6 [#uses=0]
+ ret i32 %R
}
-declare int %qux()
-
+declare i32 @qux()
diff --git a/test/Transforms/SimplifyCFG/UncondBranchToReturn.ll b/test/Transforms/SimplifyCFG/UncondBranchToReturn.ll
index 6ab1621..e6c05f3 100644
--- a/test/Transforms/SimplifyCFG/UncondBranchToReturn.ll
+++ b/test/Transforms/SimplifyCFG/UncondBranchToReturn.ll
@@ -2,32 +2,32 @@
; a PHI node and a return. Make sure the simplify cfg can straighten out this
; important case. This is basically the most trivial form of tail-duplication.
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
; RUN: not grep {br label}
-int %test(bool %B, int %A, int %B) {
- br bool %B, label %T, label %F
-T:
- br label %ret
-F:
- br label %ret
-ret:
- %X = phi int [%A, %F], [%B, %T]
- ret int %X
+define i32 @test(i1 %B, i32 %A, i32 %B.upgrd.1) {
+ br i1 %B, label %T, label %F
+T: ; preds = %0
+ br label %ret
+F: ; preds = %0
+ br label %ret
+ret: ; preds = %F, %T
+ %X = phi i32 [ %A, %F ], [ %B.upgrd.1, %T ] ; <i32> [#uses=1]
+ ret i32 %X
}
+
; Make sure it's willing to move unconditional branches to return instructions
; as well, even if the return block is shared and the source blocks are
; non-empty.
-int %test2(bool %B, int %A, int %B) {
- br bool %B, label %T, label %F
-T:
- call int %test(bool true, int 5, int 8)
- br label %ret
-F:
- call int %test(bool true, int 5, int 8)
- br label %ret
-ret:
- ret int %A
+define i32 @test2(i1 %B, i32 %A, i32 %B.upgrd.2) {
+ br i1 %B, label %T, label %F
+T: ; preds = %0
+ call i32 @test( i1 true, i32 5, i32 8 ) ; <i32>:1 [#uses=0]
+ br label %ret
+F: ; preds = %0
+ call i32 @test( i1 true, i32 5, i32 8 ) ; <i32>:2 [#uses=0]
+ br label %ret
+ret: ; preds = %F, %T
+ ret i32 %A
}
-
diff --git a/test/Transforms/SimplifyCFG/UnreachableEliminate.ll b/test/Transforms/SimplifyCFG/UnreachableEliminate.ll
index 22cd3d4..3c44919 100644
--- a/test/Transforms/SimplifyCFG/UnreachableEliminate.ll
+++ b/test/Transforms/SimplifyCFG/UnreachableEliminate.ll
@@ -1,29 +1,33 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep unreachable
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep unreachable
-void %test1(bool %C, bool* %BP) {
- br bool %C, label %T, label %F
-T:
- store bool %C, bool* %BP ;; dead
- unreachable
-F:
- ret void
+define void @test1(i1 %C, i1* %BP) {
+ br i1 %C, label %T, label %F
+T: ; preds = %0
+ store i1 %C, i1* %BP
+ unreachable
+F: ; preds = %0
+ ret void
}
-void %test2() {
- invoke void %test2() to label %N unwind label %U
-U:
- unreachable
-N:
- ret void
+define void @test2() {
+ invoke void @test2( )
+ to label %N unwind label %U
+U: ; preds = %0
+ unreachable
+N: ; preds = %0
+ ret void
}
-int %test3(int %v) {
- switch int %v, label %default [ int 1, label %U
- int 2, label %T]
-default:
- ret int 1
-U:
- unreachable
-T:
- ret int 2
+define i32 @test3(i32 %v) {
+ switch i32 %v, label %default [
+ i32 1, label %U
+ i32 2, label %T
+ ]
+default: ; preds = %0
+ ret i32 1
+U: ; preds = %0
+ unreachable
+T: ; preds = %0
+ ret i32 2
}
+
diff --git a/test/Transforms/SimplifyCFG/basictest.ll b/test/Transforms/SimplifyCFG/basictest.ll
index 18fa897..1fd629a 100644
--- a/test/Transforms/SimplifyCFG/basictest.ll
+++ b/test/Transforms/SimplifyCFG/basictest.ll
@@ -1,24 +1,25 @@
; Test CFG simplify removal of branch instructions...
;
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep br
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
-
-void "test1"() {
- br label %BB1
-BB1:
- ret void
+define void @test1() {
+ br label %BB1
+BB1: ; preds = %0
+ ret void
}
-void "test2"() {
- ret void
-BB1:
- ret void
+define void @test2() {
+ ret void
+BB1: ; No predecessors!
+ ret void
}
-void "test3"(bool %T) {
- br bool %T, label %BB1, label %BB1
-BB1:
- ret void
+define void @test3(i1 %T) {
+ br i1 %T, label %BB1, label %BB1
+BB1: ; preds = %0, %0
+ ret void
}
+
+
diff --git a/test/Transforms/SimplifyCFG/branch-cond-merge.ll b/test/Transforms/SimplifyCFG/branch-cond-merge.ll
index 2a93057..ae46503 100644
--- a/test/Transforms/SimplifyCFG/branch-cond-merge.ll
+++ b/test/Transforms/SimplifyCFG/branch-cond-merge.ll
@@ -1,22 +1,19 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -instcombine \
+; RUN: llvm-as < %s | opt -simplifycfg -instcombine \
; RUN: -simplifycfg | llvm-dis | not grep call
-declare void %bar()
+declare void @bar()
-void %test(int %X, int %Y) {
+define void @test(i32 %X, i32 %Y) {
entry:
- %tmp.2 = setne int %X, %Y
- br bool %tmp.2, label %shortcirc_next, label %UnifiedReturnBlock
-
-shortcirc_next:
- %tmp.3 = setne int %X, %Y
- br bool %tmp.3, label %UnifiedReturnBlock, label %then
-
-then:
- call void %bar( )
+ %tmp.2 = icmp ne i32 %X, %Y ; <i1> [#uses=1]
+ br i1 %tmp.2, label %shortcirc_next, label %UnifiedReturnBlock
+shortcirc_next: ; preds = %entry
+ %tmp.3 = icmp ne i32 %X, %Y ; <i1> [#uses=1]
+ br i1 %tmp.3, label %UnifiedReturnBlock, label %then
+then: ; preds = %shortcirc_next
+ call void @bar( )
+ ret void
+UnifiedReturnBlock: ; preds = %shortcirc_next, %entry
ret void
-
-UnifiedReturnBlock: ; preds = %entry, %shortcirc_next
- ret void
}
diff --git a/test/Transforms/SimplifyCFG/branch-cond-prop.ll b/test/Transforms/SimplifyCFG/branch-cond-prop.ll
index 10270c2..a7cd359 100644
--- a/test/Transforms/SimplifyCFG/branch-cond-prop.ll
+++ b/test/Transforms/SimplifyCFG/branch-cond-prop.ll
@@ -1,20 +1,17 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep call
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep call
-declare void %bar()
+declare void @bar()
-void %test(int %X, int %Y) {
+define void @test(i32 %X, i32 %Y) {
entry:
- %tmp.2 = setlt int %X, %Y ; <bool> [#uses=2]
- br bool %tmp.2, label %shortcirc_next, label %UnifiedReturnBlock
-
+ %tmp.2 = icmp slt i32 %X, %Y ; <i1> [#uses=2]
+ br i1 %tmp.2, label %shortcirc_next, label %UnifiedReturnBlock
shortcirc_next: ; preds = %entry
- br bool %tmp.2, label %UnifiedReturnBlock, label %then
-
+ br i1 %tmp.2, label %UnifiedReturnBlock, label %then
then: ; preds = %shortcirc_next
- call void %bar( )
+ call void @bar( )
+ ret void
+UnifiedReturnBlock: ; preds = %shortcirc_next, %entry
ret void
-
-UnifiedReturnBlock: ; preds = %entry, %shortcirc_next
- ret void
}
diff --git a/test/Transforms/SimplifyCFG/branch-fold-test.ll b/test/Transforms/SimplifyCFG/branch-fold-test.ll
index 3bbb101..2deca40 100644
--- a/test/Transforms/SimplifyCFG/branch-fold-test.ll
+++ b/test/Transforms/SimplifyCFG/branch-fold-test.ll
@@ -1,16 +1,17 @@
; This test ensures that the simplifycfg pass continues to constant fold
; terminator instructions.
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | not grep br
+; RUN: llvm-as < %s | opt -simplifycfg | not grep br
-int %test(int %A, int %B) {
+define i32 @test(i32 %A, i32 %B) {
J:
- %C = add int %A, 12
- br bool true, label %L, label %K ; K is dead!
-L:
- %D = add int %C, %B
- ret int %D
-K:
- %E = add int %C, %B
- ret int %E
+ %C = add i32 %A, 12 ; <i32> [#uses=2]
+ br i1 true, label %L, label %K
+L: ; preds = %J
+ %D = add i32 %C, %B ; <i32> [#uses=1]
+ ret i32 %D
+K: ; preds = %J
+ %E = add i32 %C, %B ; <i32> [#uses=1]
+ ret i32 %E
}
+
diff --git a/test/Transforms/SimplifyCFG/branch-fold.ll b/test/Transforms/SimplifyCFG/branch-fold.ll
index aeea929..d671b6e 100644
--- a/test/Transforms/SimplifyCFG/branch-fold.ll
+++ b/test/Transforms/SimplifyCFG/branch-fold.ll
@@ -1,12 +1,13 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | grep {br i1} | count 1
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | grep {br i1} | count 1
-void %test(int* %P, int* %Q, bool %A, bool %B) {
- br bool %A, label %a, label %b ;; fold the two branches into one
-a:
- br bool %B, label %b, label %c
-b:
- store int 123, int* %P
- ret void
-c:
- ret void
+define void @test(i32* %P, i32* %Q, i1 %A, i1 %B) {
+ br i1 %A, label %a, label %b
+a: ; preds = %0
+ br i1 %B, label %b, label %c
+b: ; preds = %a, %0
+ store i32 123, i32* %P
+ ret void
+c: ; preds = %a
+ ret void
}
+
diff --git a/test/Transforms/SimplifyCFG/branch-phi-thread.ll b/test/Transforms/SimplifyCFG/branch-phi-thread.ll
index e370978..abad19c 100644
--- a/test/Transforms/SimplifyCFG/branch-phi-thread.ll
+++ b/test/Transforms/SimplifyCFG/branch-phi-thread.ll
@@ -1,65 +1,66 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -adce | llvm-dis | \
+; RUN: llvm-as < %s | opt -simplifycfg -adce | llvm-dis | \
; RUN: not grep {call void %f1}
; END.
-declare void %f1()
-declare void %f2()
-declare void %f3()
-declare void %f4()
+declare void @f1()
-implementation
+declare void @f2()
-int %test1(int %X, bool %D) {
+declare void @f3()
+
+declare void @f4()
+
+define i32 @test1(i32 %X, i1 %D) {
E:
- %C = seteq int %X, 0
- br bool %C, label %T, label %F
-T:
- br bool %C, label %B, label %A
-A:
- call void %f1()
- br bool %D, label %T, label %F
-B:
- call void %f2()
- ret int 345
-F:
- call void %f3()
- ret int 123
+ %C = icmp eq i32 %X, 0 ; <i1> [#uses=2]
+ br i1 %C, label %T, label %F
+T: ; preds = %A, %E
+ br i1 %C, label %B, label %A
+A: ; preds = %T
+ call void @f1( )
+ br i1 %D, label %T, label %F
+B: ; preds = %T
+ call void @f2( )
+ ret i32 345
+F: ; preds = %A, %E
+ call void @f3( )
+ ret i32 123
}
-int %test2(int %X, bool %D) {
+define i32 @test2(i32 %X, i1 %D) {
E:
- %C = seteq int %X, 0
- br bool %C, label %T, label %F
-T:
- %P = phi bool [true, %E], [%C, %A]
- br bool %P, label %B, label %A
-A:
- call void %f1()
- br bool %D, label %T, label %F
-B:
- call void %f2()
- ret int 345
-F:
- call void %f3()
- ret int 123
+ %C = icmp eq i32 %X, 0 ; <i1> [#uses=2]
+ br i1 %C, label %T, label %F
+T: ; preds = %A, %E
+ %P = phi i1 [ true, %E ], [ %C, %A ] ; <i1> [#uses=1]
+ br i1 %P, label %B, label %A
+A: ; preds = %T
+ call void @f1( )
+ br i1 %D, label %T, label %F
+B: ; preds = %T
+ call void @f2( )
+ ret i32 345
+F: ; preds = %A, %E
+ call void @f3( )
+ ret i32 123
}
-int %test3(int %X, bool %D, int* %AP, int* %BP) {
+define i32 @test3(i32 %X, i1 %D, i32* %AP, i32* %BP) {
E:
- %C = seteq int %X, 0
- br bool %C, label %T, label %F
-T:
- call void %f3() ;; Inst in block.
- %XX = load int* %AP
- store int %XX, int* %BP
- br bool %C, label %B, label %A
-A:
- call void %f1()
- br bool %D, label %T, label %F
-B:
- call void %f2()
- ret int 345
-F:
- call void %f3()
- ret int 123
+ %C = icmp eq i32 %X, 0 ; <i1> [#uses=2]
+ br i1 %C, label %T, label %F
+T: ; preds = %A, %E
+ call void @f3( )
+ %XX = load i32* %AP ; <i32> [#uses=1]
+ store i32 %XX, i32* %BP
+ br i1 %C, label %B, label %A
+A: ; preds = %T
+ call void @f1( )
+ br i1 %D, label %T, label %F
+B: ; preds = %T
+ call void @f2( )
+ ret i32 345
+F: ; preds = %A, %E
+ call void @f3( )
+ ret i32 123
}
diff --git a/test/Transforms/SimplifyCFG/hoist-common-code.ll b/test/Transforms/SimplifyCFG/hoist-common-code.ll
index 482c5aa..7512da2 100644
--- a/test/Transforms/SimplifyCFG/hoist-common-code.ll
+++ b/test/Transforms/SimplifyCFG/hoist-common-code.ll
@@ -1,17 +1,18 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep br
-declare void %bar(int)
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
-void %test(bool %P, int* %Q) {
- br bool %P, label %T, label %F
-T:
- store int 1, int* %Q
- %A = load int* %Q
- call void %bar(int %A)
- ret void
-F:
- store int 1, int* %Q
- %B = load int* %Q
- call void %bar(int %B)
- ret void
+declare void @bar(i32)
+
+define void @test(i1 %P, i32* %Q) {
+ br i1 %P, label %T, label %F
+T: ; preds = %0
+ store i32 1, i32* %Q
+ %A = load i32* %Q ; <i32> [#uses=1]
+ call void @bar( i32 %A )
+ ret void
+F: ; preds = %0
+ store i32 1, i32* %Q
+ %B = load i32* %Q ; <i32> [#uses=1]
+ call void @bar( i32 %B )
+ ret void
}
diff --git a/test/Transforms/SimplifyCFG/return-merge.ll b/test/Transforms/SimplifyCFG/return-merge.ll
index cbcfddb..60267e9 100644
--- a/test/Transforms/SimplifyCFG/return-merge.ll
+++ b/test/Transforms/SimplifyCFG/return-merge.ll
@@ -1,18 +1,19 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep br
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
-int %test1(bool %C) {
+define i32 @test1(i1 %C) {
entry:
- br bool %C, label %T, label %F
-T:
- ret int 1
-F:
- ret int 0
+ br i1 %C, label %T, label %F
+T: ; preds = %entry
+ ret i32 1
+F: ; preds = %entry
+ ret i32 0
}
-void %test2(bool %C) {
- br bool %C, label %T, label %F
-T:
- ret void
-F:
- ret void
+define void @test2(i1 %C) {
+ br i1 %C, label %T, label %F
+T: ; preds = %0
+ ret void
+F: ; preds = %0
+ ret void
}
+
diff --git a/test/Transforms/SimplifyCFG/switch-simplify-crash.ll b/test/Transforms/SimplifyCFG/switch-simplify-crash.ll
index 096f2ae..74559a0 100644
--- a/test/Transforms/SimplifyCFG/switch-simplify-crash.ll
+++ b/test/Transforms/SimplifyCFG/switch-simplify-crash.ll
@@ -1,153 +1,108 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -disable-output
+; RUN: llvm-as < %s | opt -simplifycfg -disable-output
-
-void %NewExtractNames() {
+define void @NewExtractNames() {
entry:
- br bool false, label %endif.0, label %then.0
-
+ br i1 false, label %endif.0, label %then.0
then.0: ; preds = %entry
- br bool false, label %shortcirc_next.i, label %shortcirc_done.i
-
+ br i1 false, label %shortcirc_next.i, label %shortcirc_done.i
shortcirc_next.i: ; preds = %then.0
br label %shortcirc_done.i
-
shortcirc_done.i: ; preds = %shortcirc_next.i, %then.0
- br bool false, label %then.0.i, label %else.0.i
-
+ br i1 false, label %then.0.i, label %else.0.i
then.0.i: ; preds = %shortcirc_done.i
br label %NewBase.exit
-
else.0.i: ; preds = %shortcirc_done.i
- br bool false, label %endif.0.i, label %else.1.i
-
+ br i1 false, label %endif.0.i, label %else.1.i
else.1.i: ; preds = %else.0.i
- br bool false, label %endif.0.i, label %else.2.i
-
+ br i1 false, label %endif.0.i, label %else.2.i
else.2.i: ; preds = %else.1.i
br label %NewBase.exit
-
endif.0.i: ; preds = %else.1.i, %else.0.i
br label %NewBase.exit
-
NewBase.exit: ; preds = %endif.0.i, %else.2.i, %then.0.i
br label %endif.0
-
endif.0: ; preds = %NewBase.exit, %entry
- %tmp.32.mask = and uint 0, 31 ; <uint> [#uses=1]
- switch uint %tmp.32.mask, label %label.9 [
- uint 16, label %loopentry.2
- uint 15, label %loopentry.2
- uint 14, label %loopentry.2
- uint 13, label %loopentry.2
- uint 10, label %loopentry.2
- uint 20, label %loopentry.1
- uint 19, label %loopentry.1
- uint 2, label %loopentry.0
- uint 0, label %switchexit
+ %tmp.32.mask = and i32 0, 31 ; <i32> [#uses=1]
+ switch i32 %tmp.32.mask, label %label.9 [
+ i32 16, label %loopentry.2
+ i32 15, label %loopentry.2
+ i32 14, label %loopentry.2
+ i32 13, label %loopentry.2
+ i32 10, label %loopentry.2
+ i32 20, label %loopentry.1
+ i32 19, label %loopentry.1
+ i32 2, label %loopentry.0
+ i32 0, label %switchexit
]
-
loopentry.0: ; preds = %endif.1, %endif.0
- br bool false, label %no_exit.0, label %switchexit
-
+ br i1 false, label %no_exit.0, label %switchexit
no_exit.0: ; preds = %loopentry.0
- br bool false, label %then.1, label %else.1
-
+ br i1 false, label %then.1, label %else.1
then.1: ; preds = %no_exit.0
br label %endif.1
-
else.1: ; preds = %no_exit.0
- br bool false, label %shortcirc_next.0, label %shortcirc_done.0
-
+ br i1 false, label %shortcirc_next.0, label %shortcirc_done.0
shortcirc_next.0: ; preds = %else.1
br label %shortcirc_done.0
-
shortcirc_done.0: ; preds = %shortcirc_next.0, %else.1
- br bool false, label %then.2, label %endif.2
-
+ br i1 false, label %then.2, label %endif.2
then.2: ; preds = %shortcirc_done.0
br label %endif.2
-
endif.2: ; preds = %then.2, %shortcirc_done.0
br label %endif.1
-
endif.1: ; preds = %endif.2, %then.1
br label %loopentry.0
-
loopentry.1: ; preds = %endif.3, %endif.0, %endif.0
- br bool false, label %no_exit.1, label %switchexit
-
+ br i1 false, label %no_exit.1, label %switchexit
no_exit.1: ; preds = %loopentry.1
- br bool false, label %then.3, label %else.2
-
+ br i1 false, label %then.3, label %else.2
then.3: ; preds = %no_exit.1
br label %endif.3
-
else.2: ; preds = %no_exit.1
- br bool false, label %shortcirc_next.1, label %shortcirc_done.1
-
+ br i1 false, label %shortcirc_next.1, label %shortcirc_done.1
shortcirc_next.1: ; preds = %else.2
br label %shortcirc_done.1
-
shortcirc_done.1: ; preds = %shortcirc_next.1, %else.2
- br bool false, label %then.4, label %endif.4
-
+ br i1 false, label %then.4, label %endif.4
then.4: ; preds = %shortcirc_done.1
br label %endif.4
-
endif.4: ; preds = %then.4, %shortcirc_done.1
br label %endif.3
-
endif.3: ; preds = %endif.4, %then.3
br label %loopentry.1
-
loopentry.2: ; preds = %endif.5, %endif.0, %endif.0, %endif.0, %endif.0, %endif.0
- %i.3 = phi int [ 0, %endif.5 ], [ 0, %endif.0 ], [ 0, %endif.0 ], [ 0, %endif.0 ], [ 0, %endif.0 ], [ 0, %endif.0 ] ; <int> [#uses=1]
- %tmp.158 = setlt int %i.3, 0 ; <bool> [#uses=1]
- br bool %tmp.158, label %no_exit.2, label %switchexit
-
+ %i.3 = phi i32 [ 0, %endif.5 ], [ 0, %endif.0 ], [ 0, %endif.0 ], [ 0, %endif.0 ], [ 0, %endif.0 ], [ 0, %endif.0 ] ; <i32> [#uses=1]
+ %tmp.158 = icmp slt i32 %i.3, 0 ; <i1> [#uses=1]
+ br i1 %tmp.158, label %no_exit.2, label %switchexit
no_exit.2: ; preds = %loopentry.2
- br bool false, label %shortcirc_next.2, label %shortcirc_done.2
-
+ br i1 false, label %shortcirc_next.2, label %shortcirc_done.2
shortcirc_next.2: ; preds = %no_exit.2
br label %shortcirc_done.2
-
shortcirc_done.2: ; preds = %shortcirc_next.2, %no_exit.2
- br bool false, label %then.5, label %endif.5
-
+ br i1 false, label %then.5, label %endif.5
then.5: ; preds = %shortcirc_done.2
br label %endif.5
-
endif.5: ; preds = %then.5, %shortcirc_done.2
br label %loopentry.2
-
label.9: ; preds = %endif.0
- br bool false, label %then.6, label %endif.6
-
+ br i1 false, label %then.6, label %endif.6
then.6: ; preds = %label.9
br label %endif.6
-
endif.6: ; preds = %then.6, %label.9
- store int 0, int* null
+ store i32 0, i32* null
br label %switchexit
-
switchexit: ; preds = %endif.6, %loopentry.2, %loopentry.1, %loopentry.0, %endif.0
- br bool false, label %endif.7, label %then.7
-
+ br i1 false, label %endif.7, label %then.7
then.7: ; preds = %switchexit
- br bool false, label %shortcirc_next.3, label %shortcirc_done.3
-
+ br i1 false, label %shortcirc_next.3, label %shortcirc_done.3
shortcirc_next.3: ; preds = %then.7
br label %shortcirc_done.3
-
shortcirc_done.3: ; preds = %shortcirc_next.3, %then.7
- br bool false, label %then.8, label %endif.8
-
+ br i1 false, label %then.8, label %endif.8
then.8: ; preds = %shortcirc_done.3
br label %endif.8
-
endif.8: ; preds = %then.8, %shortcirc_done.3
br label %endif.7
-
endif.7: ; preds = %endif.8, %switchexit
ret void
}
diff --git a/test/Transforms/SimplifyCFG/switch_create.ll b/test/Transforms/SimplifyCFG/switch_create.ll
index 2d72291..4994cd3 100644
--- a/test/Transforms/SimplifyCFG/switch_create.ll
+++ b/test/Transforms/SimplifyCFG/switch_create.ll
@@ -1,48 +1,47 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep br
-
-declare void %foo1()
-declare void %foo2()
-
-void %test1(uint %V) {
- %C1 = seteq uint %V, 4
- %C2 = seteq uint %V, 17
- %CN = or bool %C1, %C2
- br bool %CN, label %T, label %F
-T:
- call void %foo1()
- ret void
-F:
- call void %foo2()
- ret void
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
+
+declare void @foo1()
+
+declare void @foo2()
+
+define void @test1(i32 %V) {
+ %C1 = icmp eq i32 %V, 4 ; <i1> [#uses=1]
+ %C2 = icmp eq i32 %V, 17 ; <i1> [#uses=1]
+ %CN = or i1 %C1, %C2 ; <i1> [#uses=1]
+ br i1 %CN, label %T, label %F
+T: ; preds = %0
+ call void @foo1( )
+ ret void
+F: ; preds = %0
+ call void @foo2( )
+ ret void
}
-
-void %test2(int %V) {
- %C1 = setne int %V, 4
- %C2 = setne int %V, 17
- %CN = and bool %C1, %C2
- br bool %CN, label %T, label %F
-T:
- call void %foo1()
- ret void
-F:
- call void %foo2()
- ret void
+define void @test2(i32 %V) {
+ %C1 = icmp ne i32 %V, 4 ; <i1> [#uses=1]
+ %C2 = icmp ne i32 %V, 17 ; <i1> [#uses=1]
+ %CN = and i1 %C1, %C2 ; <i1> [#uses=1]
+ br i1 %CN, label %T, label %F
+T: ; preds = %0
+ call void @foo1( )
+ ret void
+F: ; preds = %0
+ call void @foo2( )
+ ret void
}
-
-void %test3(int %V) {
- %C1 = seteq int %V, 4
- br bool %C1, label %T, label %N
-N:
- %C2 = seteq int %V, 17
- br bool %C2, label %T, label %F
-T:
- call void %foo1()
- ret void
-F:
- call void %foo2()
- ret void
+define void @test3(i32 %V) {
+ %C1 = icmp eq i32 %V, 4 ; <i1> [#uses=1]
+ br i1 %C1, label %T, label %N
+N: ; preds = %0
+ %C2 = icmp eq i32 %V, 17 ; <i1> [#uses=1]
+ br i1 %C2, label %T, label %F
+T: ; preds = %N, %0
+ call void @foo1( )
+ ret void
+F: ; preds = %N
+ call void @foo2( )
+ ret void
}
diff --git a/test/Transforms/SimplifyCFG/switch_formation.ll b/test/Transforms/SimplifyCFG/switch_formation.ll
index b372ca4b..534c471 100644
--- a/test/Transforms/SimplifyCFG/switch_formation.ll
+++ b/test/Transforms/SimplifyCFG/switch_formation.ll
@@ -1,37 +1,31 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep br
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | not grep br
; END.
-bool %_ZN4llvm11SetCondInst7classofEPKNS_11InstructionE({uint, uint}* %I) {
+define i1 @_ZN4llvm11SetCondInst7classofEPKNS_11InstructionE({ i32, i32 }* %I) {
entry:
- %tmp.1.i = getelementptr {uint, uint}* %I, long 0, uint 1
- %tmp.2.i = load uint* %tmp.1.i
- %tmp.2 = seteq uint %tmp.2.i, 14
- br bool %tmp.2, label %shortcirc_done.4, label %shortcirc_next.0
-
-shortcirc_next.0: ; preds = %entry
- %tmp.6 = seteq uint %tmp.2.i, 15 ; <bool> [#uses=1]
- br bool %tmp.6, label %shortcirc_done.4, label %shortcirc_next.1
-
-shortcirc_next.1: ; preds = %shortcirc_next.0
- %tmp.11 = seteq uint %tmp.2.i, 16 ; <bool> [#uses=1]
- br bool %tmp.11, label %shortcirc_done.4, label %shortcirc_next.2
-
-shortcirc_next.2: ; preds = %shortcirc_next.1
- %tmp.16 = seteq uint %tmp.2.i, 17 ; <bool> [#uses=1]
- br bool %tmp.16, label %shortcirc_done.4, label %shortcirc_next.3
-
-shortcirc_next.3: ; preds = %shortcirc_next.2
- %tmp.21 = seteq uint %tmp.2.i, 18 ; <bool> [#uses=1]
- br bool %tmp.21, label %shortcirc_done.4, label %shortcirc_next.4
-
-shortcirc_next.4: ; preds = %shortcirc_next.3
- %tmp.26 = seteq uint %tmp.2.i, 19 ; <bool> [#uses=1]
- br label %UnifiedReturnBlock
-
-shortcirc_done.4: ; preds = %entry, %shortcirc_next.0, %shortcirc_next.1, %shortcirc_next.2, %shortcirc_next.3
- br label %UnifiedReturnBlock
-
-UnifiedReturnBlock: ; preds = %shortcirc_next.4, %shortcirc_done.4
- %UnifiedRetVal = phi bool [ %tmp.26, %shortcirc_next.4 ], [ true, %shortcirc_done.4 ] ; <bool> [#uses=1]
- ret bool %UnifiedRetVal
+ %tmp.1.i = getelementptr { i32, i32 }* %I, i64 0, i32 1 ; <i32*> [#uses=1]
+ %tmp.2.i = load i32* %tmp.1.i ; <i32> [#uses=6]
+ %tmp.2 = icmp eq i32 %tmp.2.i, 14 ; <i1> [#uses=1]
+ br i1 %tmp.2, label %shortcirc_done.4, label %shortcirc_next.0
+shortcirc_next.0: ; preds = %entry
+ %tmp.6 = icmp eq i32 %tmp.2.i, 15 ; <i1> [#uses=1]
+ br i1 %tmp.6, label %shortcirc_done.4, label %shortcirc_next.1
+shortcirc_next.1: ; preds = %shortcirc_next.0
+ %tmp.11 = icmp eq i32 %tmp.2.i, 16 ; <i1> [#uses=1]
+ br i1 %tmp.11, label %shortcirc_done.4, label %shortcirc_next.2
+shortcirc_next.2: ; preds = %shortcirc_next.1
+ %tmp.16 = icmp eq i32 %tmp.2.i, 17 ; <i1> [#uses=1]
+ br i1 %tmp.16, label %shortcirc_done.4, label %shortcirc_next.3
+shortcirc_next.3: ; preds = %shortcirc_next.2
+ %tmp.21 = icmp eq i32 %tmp.2.i, 18 ; <i1> [#uses=1]
+ br i1 %tmp.21, label %shortcirc_done.4, label %shortcirc_next.4
+shortcirc_next.4: ; preds = %shortcirc_next.3
+ %tmp.26 = icmp eq i32 %tmp.2.i, 19 ; <i1> [#uses=1]
+ br label %UnifiedReturnBlock
+shortcirc_done.4: ; preds = %shortcirc_next.3, %shortcirc_next.2, %shortcirc_next.1, %shortcirc_next.0, %entry
+ br label %UnifiedReturnBlock
+UnifiedReturnBlock: ; preds = %shortcirc_done.4, %shortcirc_next.4
+ %UnifiedRetVal = phi i1 [ %tmp.26, %shortcirc_next.4 ], [ true, %shortcirc_done.4 ] ; <i1> [#uses=1]
+ ret i1 %UnifiedRetVal
}
+
diff --git a/test/Transforms/SimplifyCFG/switch_switch_fold.ll b/test/Transforms/SimplifyCFG/switch_switch_fold.ll
index 5cfa4ea..1590f34 100644
--- a/test/Transforms/SimplifyCFG/switch_switch_fold.ll
+++ b/test/Transforms/SimplifyCFG/switch_switch_fold.ll
@@ -1,47 +1,47 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
; RUN: grep switch | count 1
; Test that a switch going to a switch on the same value can be merged. All
; three switches in this example can be merged into one big one.
-declare void %foo1()
-declare void %foo2()
-declare void %foo3()
-declare void %foo4()
+declare void @foo1()
-void %test1(uint %V) {
- switch uint %V, label %F [
- uint 4, label %T
- uint 17, label %T
- uint 5, label %T
- uint 1234, label %F
- ]
+declare void @foo2()
+
+declare void @foo3()
-T:
- switch uint %V, label %F [
- uint 4, label %A
- uint 17, label %B
- uint 42, label %C
+declare void @foo4()
+
+define void @test1(i32 %V) {
+ switch i32 %V, label %F [
+ i32 4, label %T
+ i32 17, label %T
+ i32 5, label %T
+ i32 1234, label %F
+ ]
+T: ; preds = %0, %0, %0
+ switch i32 %V, label %F [
+ i32 4, label %A
+ i32 17, label %B
+ i32 42, label %C
]
-A:
- call void %foo1()
+A: ; preds = %T
+ call void @foo1( )
ret void
-
-B:
- call void %foo2()
+B: ; preds = %F, %F, %T
+ call void @foo2( )
ret void
-C:
- call void %foo3()
- ret void
-
-F:
- switch uint %V, label %F [
- uint 4, label %B
- uint 18, label %B
- uint 42, label %D
+C: ; preds = %T
+ call void @foo3( )
+ ret void
+F: ; preds = %F, %T, %0, %0
+ switch i32 %V, label %F [
+ i32 4, label %B
+ i32 18, label %B
+ i32 42, label %D
]
-D:
- call void %foo4()
+D: ; preds = %F
+ call void @foo4( )
ret void
}