Upgrade tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48536 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Tanya Lattner 2008-03-19 05:39:35 +00:00
parent d8ff3caaa0
commit ce7d5db4d8
26 changed files with 616 additions and 729 deletions

View File

@ -1,13 +1,11 @@
; Uninitialized values are not handled correctly.
;
; RUN: llvm-upgrade < %s | llvm-as | opt -mem2reg
; RUN: llvm-as < %s | opt -mem2reg
;
implementation
int "test"()
begin
%X = alloca int ; To be promoted
%Y = load int* %X
ret int %Y
end
define i32 @test() {
; To be promoted
%X = alloca i32 ; <i32*> [#uses=1]
%Y = load i32* %X ; <i32> [#uses=1]
ret i32 %Y
}

View File

@ -1,15 +1,12 @@
; This input caused the mem2reg pass to die because it was trying to promote
; the %r alloca, even though it is invalid to do so in this case!
;
; RUN: llvm-upgrade < %s | llvm-as | opt -mem2reg
; RUN: llvm-as < %s | opt -mem2reg
implementation
void "test"()
begin
%r = alloca int ; <int*> [#uses=2]
store int 4, int* %r
store int* %r, int** null
define void @test() {
%r = alloca i32 ; <i32*> [#uses=2]
store i32 4, i32* %r
store i32* %r, i32** null
ret void
end
}

View File

@ -1,11 +1,10 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -mem2reg
; RUN: llvm-as < %s | opt -mem2reg
implementation ; Functions:
void %_Z3barv() {
%result = alloca int
define void @_Z3barv() {
%result = alloca i32 ; <i32*> [#uses=1]
ret void
store int 0, int* %result ; DF not set!
; No predecessors!
store i32 0, i32* %result
ret void
}

View File

@ -1,22 +1,19 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -predsimplify -disable-output
; RUN: llvm-as < %s | opt -predsimplify -disable-output
fastcc void %_ov_splice(int %n1, int %n2, int %ch2) {
define fastcc void @_ov_splice(i32 %n1, i32 %n2, i32 %ch2) {
entry:
%tmp = setgt int %n1, %n2 ; <bool> [#uses=1]
%n.0 = select bool %tmp, int %n2, int %n1 ; <int> [#uses=1]
%tmp104 = setlt int 0, %ch2 ; <bool> [#uses=1]
br bool %tmp104, label %cond_true105, label %return
%tmp = icmp sgt i32 %n1, %n2 ; <i1> [#uses=1]
%n.0 = select i1 %tmp, i32 %n2, i32 %n1 ; <i32> [#uses=1]
%tmp104 = icmp slt i32 0, %ch2 ; <i1> [#uses=1]
br i1 %tmp104, label %cond_true105, label %return
cond_true95: ; preds = %cond_true105
ret void
bb98: ; preds = %cond_true105
ret void
cond_true105: ; preds = %entry
%tmp94 = setgt int %n.0, 0 ; <bool> [#uses=1]
br bool %tmp94, label %cond_true95, label %bb98
%tmp94 = icmp sgt i32 %n.0, 0 ; <i1> [#uses=1]
br i1 %tmp94, label %cond_true95, label %bb98
return: ; preds = %entry
ret void
}

View File

@ -1,28 +1,23 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -predsimplify -disable-output
; RUN: llvm-as < %s | opt -predsimplify -disable-output
void %safe_strcpy(uint %size1) {
define void @safe_strcpy(i32 %size1) {
entry:
%tmp = seteq uint %size1, 0 ; <bool> [#uses=1]
br bool %tmp, label %return, label %strlen.exit
%tmp = icmp eq i32 %size1, 0 ; <i1> [#uses=1]
br i1 %tmp, label %return, label %strlen.exit
strlen.exit: ; preds = %entry
%tmp = cast ulong 0 to uint ; <uint> [#uses=2]
%tmp6 = setlt uint %tmp, %size1 ; <bool> [#uses=1]
br bool %tmp6, label %cond_true7, label %cond_false19
%tmp.upgrd.1 = trunc i64 0 to i32 ; <i32> [#uses=2]
%tmp6 = icmp ult i32 %tmp.upgrd.1, %size1 ; <i1> [#uses=1]
br i1 %tmp6, label %cond_true7, label %cond_false19
cond_true7: ; preds = %strlen.exit
%tmp9 = seteq uint %tmp, 0 ; <bool> [#uses=1]
br bool %tmp9, label %cond_next15, label %cond_true10
%tmp9 = icmp eq i32 %tmp.upgrd.1, 0 ; <i1> [#uses=1]
br i1 %tmp9, label %cond_next15, label %cond_true10
cond_true10: ; preds = %cond_true7
ret void
cond_next15: ; preds = %cond_true7
ret void
cond_false19: ; preds = %strlen.exit
ret void
return: ; preds = %entry
ret void
}

View File

@ -1,28 +1,24 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -predsimplify -disable-output
; RUN: llvm-as < %s | opt -predsimplify -disable-output
void %gs_image_next() {
define void @gs_image_next() {
entry:
%tmp = load uint* null ; <uint> [#uses=2]
br bool false, label %cond_next21, label %UnifiedReturnBlock
%tmp = load i32* null ; <i32> [#uses=2]
br i1 false, label %cond_next21, label %UnifiedReturnBlock
cond_next21: ; preds = %entry
br bool false, label %cond_next42, label %UnifiedReturnBlock
br i1 false, label %cond_next42, label %UnifiedReturnBlock
cond_next42: ; preds = %cond_next21
br label %cond_true158
cond_next134: ; preds = %cond_true158
%tmp1571 = seteq uint 0, %min ; <bool> [#uses=0]
%tmp1571 = icmp eq i32 0, %min ; <i1> [#uses=0]
ret void
cond_true158: ; preds = %cond_true158, %cond_next42
%tmp47 = sub uint %tmp, 0 ; <uint> [#uses=2]
%tmp49 = setle uint %tmp47, 0 ; <bool> [#uses=1]
%min = select bool %tmp49, uint %tmp47, uint 0 ; <uint> [#uses=2]
%tmp92 = add uint %min, 0 ; <uint> [#uses=1]
%tmp101 = seteq uint %tmp92, %tmp ; <bool> [#uses=1]
br bool %tmp101, label %cond_next134, label %cond_true158
%tmp47 = sub i32 %tmp, 0 ; <i32> [#uses=2]
%tmp49 = icmp ule i32 %tmp47, 0 ; <i1> [#uses=1]
%min = select i1 %tmp49, i32 %tmp47, i32 0 ; <i32> [#uses=2]
%tmp92 = add i32 %min, 0 ; <i32> [#uses=1]
%tmp101 = icmp eq i32 %tmp92, %tmp ; <i1> [#uses=1]
br i1 %tmp101, label %cond_next134, label %cond_true158
UnifiedReturnBlock: ; preds = %cond_next21, %entry
ret void
}

View File

@ -1,54 +1,46 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -predsimplify | llvm-dis | grep br | grep return.i.bb8_crit_edge | grep false
; RUN: llvm-as < %s | opt -predsimplify | llvm-dis | grep br | grep return.i.bb8_crit_edge | grep false
@str = external global [4 x i8] ; <[4 x i8]*> [#uses=1]
%str = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=1]
declare i32 @sprintf(i8*, i8*, ...)
implementation ; Functions:
declare int %sprintf(sbyte*, sbyte*, ...)
int %main() {
define i32 @main() {
entry:
br label %cond_true.outer
cond_true.outer: ; preds = %cond_true.i, %entry
%i.0.0.ph = phi int [ 0, %entry ], [ %tmp5, %cond_true.i ] ; <int> [#uses=1]
%j.0.0.ph = phi int [ 0, %entry ], [ %tmp312, %cond_true.i ] ; <int> [#uses=2]
%i.0.0.ph = phi i32 [ 0, %entry ], [ %tmp5, %cond_true.i ] ; <i32> [#uses=1]
%j.0.0.ph = phi i32 [ 0, %entry ], [ %tmp312, %cond_true.i ] ; <i32> [#uses=2]
br label %cond_true
cond_true: ; preds = %return.i, %cond_true.outer
%indvar.ui = phi uint [ 0, %cond_true.outer ], [ %indvar.next, %return.i ] ; <uint> [#uses=2]
%indvar = cast uint %indvar.ui to int ; <int> [#uses=1]
%i.0.0 = add int %indvar, %i.0.0.ph ; <int> [#uses=3]
%savedstack = call sbyte* %llvm.stacksave( ) ; <sbyte*> [#uses=2]
%tmp.i = seteq int %i.0.0, 0 ; <bool> [#uses=1]
%tmp5 = add int %i.0.0, 1 ; <int> [#uses=3]
br bool %tmp.i, label %return.i, label %cond_true.i
%indvar.ui = phi i32 [ 0, %cond_true.outer ], [ %indvar.next, %return.i ] ; <i32> [#uses=2]
%indvar = bitcast i32 %indvar.ui to i32 ; <i32> [#uses=1]
%i.0.0 = add i32 %indvar, %i.0.0.ph ; <i32> [#uses=3]
%savedstack = call i8* @llvm.stacksave( ) ; <i8*> [#uses=2]
%tmp.i = icmp eq i32 %i.0.0, 0 ; <i1> [#uses=1]
%tmp5 = add i32 %i.0.0, 1 ; <i32> [#uses=3]
br i1 %tmp.i, label %return.i, label %cond_true.i
cond_true.i: ; preds = %cond_true
%tmp.i = alloca [1000 x sbyte] ; <[1000 x sbyte]*> [#uses=1]
%tmp.sub.i = getelementptr [1000 x sbyte]* %tmp.i, int 0, int 0 ; <sbyte*> [#uses=2]
%tmp4.i = call int (sbyte*, sbyte*, ...)* %sprintf( sbyte* %tmp.sub.i, sbyte* getelementptr ([4 x sbyte]* %str, int 0, uint 0), int %i.0.0 ) ; <int> [#uses=0]
%tmp.i = load sbyte* %tmp.sub.i ; <sbyte> [#uses=1]
%tmp7.i = cast sbyte %tmp.i to int ; <int> [#uses=1]
call void %llvm.stackrestore( sbyte* %savedstack )
%tmp312 = add int %tmp7.i, %j.0.0.ph ; <int> [#uses=2]
%tmp19 = setgt int %tmp5, 9999 ; <bool> [#uses=1]
br bool %tmp19, label %bb8, label %cond_true.outer
%tmp.i.upgrd.1 = alloca [1000 x i8] ; <[1000 x i8]*> [#uses=1]
%tmp.sub.i = getelementptr [1000 x i8]* %tmp.i.upgrd.1, i32 0, i32 0 ; <i8*> [#uses=2]
%tmp4.i = call i32 (i8*, i8*, ...)* @sprintf( i8* %tmp.sub.i, i8* getelementptr ([4 x i8]* @str, i32 0, i64 0), i32 %i.0.0 ) ; <i32> [#uses=0]
%tmp.i.upgrd.2 = load i8* %tmp.sub.i ; <i8> [#uses=1]
%tmp7.i = sext i8 %tmp.i.upgrd.2 to i32 ; <i32> [#uses=1]
call void @llvm.stackrestore( i8* %savedstack )
%tmp312 = add i32 %tmp7.i, %j.0.0.ph ; <i32> [#uses=2]
%tmp19 = icmp sgt i32 %tmp5, 9999 ; <i1> [#uses=1]
br i1 %tmp19, label %bb8, label %cond_true.outer
return.i: ; preds = %cond_true
call void %llvm.stackrestore( sbyte* %savedstack )
%tmp21 = setgt int %tmp5, 9999 ; <bool> [#uses=1]
%indvar.next = add uint %indvar.ui, 1 ; <uint> [#uses=1]
br bool %tmp21, label %bb8, label %cond_true
call void @llvm.stackrestore( i8* %savedstack )
%tmp21 = icmp sgt i32 %tmp5, 9999 ; <i1> [#uses=1]
%indvar.next = add i32 %indvar.ui, 1 ; <i32> [#uses=1]
br i1 %tmp21, label %bb8, label %cond_true
bb8: ; preds = %return.i, %cond_true.i
%j.0.1 = phi int [ %j.0.0.ph, %return.i ], [ %tmp312, %cond_true.i ] ; <int> [#uses=1]
%tmp10 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([4 x sbyte]* %str, int 0, uint 0), int %j.0.1 ) ; <int> [#uses=0]
ret int undef
%j.0.1 = phi i32 [ %j.0.0.ph, %return.i ], [ %tmp312, %cond_true.i ] ; <i32> [#uses=1]
%tmp10 = call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @str, i32 0, i64 0), i32 %j.0.1 ) ; <i32> [#uses=0]
ret i32 undef
}
declare int %printf(sbyte*, ...)
declare i32 @printf(i8*, ...)
declare sbyte* %llvm.stacksave()
declare i8* @llvm.stacksave()
declare void %llvm.stackrestore(sbyte*)
declare void @llvm.stackrestore(i8*)

View File

@ -1,53 +1,48 @@
; RUN: llvm-upgrade < %s | llvm-as | \
; RUN: llvm-as < %s | \
; RUN: opt -predsimplify -instcombine -simplifycfg | llvm-dis > %t
; RUN: grep -v declare %t | not grep fail
; RUN: grep -v declare %t | grep pass | count 3
int %test1(int %x, int %y) {
define i32 @test1(i32 %x, i32 %y) {
entry:
%tmp2 = or int %x, %y ; <int> [#uses=1]
%tmp = seteq int %tmp2, 0 ; <bool> [#uses=1]
br bool %tmp, label %cond_true, label %return
%tmp2 = or i32 %x, %y ; <i32> [#uses=1]
%tmp = icmp eq i32 %tmp2, 0 ; <i1> [#uses=1]
br i1 %tmp, label %cond_true, label %return
cond_true: ; preds = %entry
%tmp4 = seteq int %x, 0 ; <bool> [#uses=1]
br bool %tmp4, label %cond_true5, label %cond_false
%tmp4 = icmp eq i32 %x, 0 ; <i1> [#uses=1]
br i1 %tmp4, label %cond_true5, label %cond_false
cond_true5: ; preds = %cond_true
%tmp6 = call int %pass( ) ; <int> [#uses=1]
ret int %tmp6
cond_false:
%tmp8 = call int %fail ( ) ; <int> [#uses=1]
ret int %tmp8
return: ; preds = %cond_next7
ret int 0
%tmp6 = call i32 @pass( ) ; <i32> [#uses=1]
ret i32 %tmp6
cond_false: ; preds = %cond_true
%tmp8 = call i32 @fail( ) ; <i32> [#uses=1]
ret i32 %tmp8
return: ; preds = %entry
ret i32 0
}
int %test2(int %x, int %y) {
define i32 @test2(i32 %x, i32 %y) {
entry:
%tmp2 = or int %x, %y ; <int> [#uses=1]
%tmp = setne int %tmp2, 0 ; <bool> [#uses=1]
br bool %tmp, label %cond_true, label %return
%tmp2 = or i32 %x, %y ; <i32> [#uses=1]
%tmp = icmp ne i32 %tmp2, 0 ; <i1> [#uses=1]
br i1 %tmp, label %cond_true, label %return
cond_true: ; preds = %entry
%tmp4 = seteq int %x, 0 ; <bool> [#uses=1]
br bool %tmp4, label %cond_true5, label %cond_false
%tmp4 = icmp eq i32 %x, 0 ; <i1> [#uses=1]
br i1 %tmp4, label %cond_true5, label %cond_false
cond_true5: ; preds = %cond_true
%tmp6 = call int %pass1( ) ; <int> [#uses=1]
ret int %tmp6
cond_false:
%tmp8 = call int %pass2( ) ; <int> [#uses=1]
ret int %tmp8
return: ; preds = %cond_next7
ret int 0
%tmp6 = call i32 @pass1( ) ; <i32> [#uses=1]
ret i32 %tmp6
cond_false: ; preds = %cond_true
%tmp8 = call i32 @pass2( ) ; <i32> [#uses=1]
ret i32 %tmp8
return: ; preds = %entry
ret i32 0
}
declare int %fail()
declare int %pass()
declare int %pass1()
declare int %pass2()
declare i32 @fail()
declare i32 @pass()
declare i32 @pass1()
declare i32 @pass2()

View File

@ -1,28 +1,26 @@
; RUN: llvm-upgrade < %s | llvm-as | \
; RUN: llvm-as < %s | \
; RUN: opt -predsimplify -instcombine -simplifycfg | llvm-dis | \
; RUN: grep -v declare | grep pass | count 2
int %test(int %x, int %y) {
define i32 @test(i32 %x, i32 %y) {
entry:
%tmp2 = setlt int %x, %y
%tmp = setne bool %tmp2, true
br bool %tmp, label %cond_true, label %return
%tmp2 = icmp slt i32 %x, %y ; <i1> [#uses=1]
%tmp = icmp ne i1 %tmp2, true ; <i1> [#uses=1]
br i1 %tmp, label %cond_true, label %return
cond_true: ; preds = %entry
%tmp4 = seteq int %x, %y ; <bool> [#uses=1]
br bool %tmp4, label %cond_true5, label %cond_false
%tmp4 = icmp eq i32 %x, %y ; <i1> [#uses=1]
br i1 %tmp4, label %cond_true5, label %cond_false
cond_true5: ; preds = %cond_true
%tmp6 = call int %pass1( ) ; <int> [#uses=1]
ret int %tmp6
cond_false:
%tmp8 = call int %pass2( ) ; <int> [#uses=1]
ret int %tmp8
return: ; preds = %cond_next7
ret int 0
%tmp6 = call i32 @pass1( ) ; <i32> [#uses=1]
ret i32 %tmp6
cond_false: ; preds = %cond_true
%tmp8 = call i32 @pass2( ) ; <i32> [#uses=1]
ret i32 %tmp8
return: ; preds = %entry
ret i32 0
}
declare int %pass1()
declare int %pass2()
declare i32 @pass1()
declare i32 @pass2()

View File

@ -1,19 +1,16 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -predsimplify -disable-output
; RUN: llvm-as < %s | opt -predsimplify -disable-output
void %readMotionInfoFromNAL() {
define void @readMotionInfoFromNAL() {
entry:
br bool false, label %bb2425, label %cond_next30
br i1 false, label %bb2425, label %cond_next30
cond_next30: ; preds = %entry
ret void
bb2418: ; preds = %bb2425
ret void
bb2425: ; preds = %entry
%tmp2427 = setgt int 0, 3 ; <bool> [#uses=1]
br bool %tmp2427, label %cond_next2429, label %bb2418
%tmp2427 = icmp sgt i32 0, 3 ; <i1> [#uses=1]
br i1 %tmp2427, label %cond_next2429, label %bb2418
cond_next2429: ; preds = %bb2425
ret void
}

View File

@ -1,30 +1,25 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -predsimplify -disable-output
; RUN: llvm-as < %s | opt -predsimplify -disable-output
int %test_wp_B_slice(int %select_method) {
define i32 @test_wp_B_slice(i32 %select_method) {
entry:
br label %bb309
cond_true114: ; preds = %bb309
%tmp130 = setlt int 0, 128 ; <bool> [#uses=1]
%min = select bool %tmp130, int 0, int 127 ; <int> [#uses=2]
%tmp143 = load int* null ; <int> [#uses=1]
br bool false, label %bb303, label %bb314
%tmp130 = icmp slt i32 0, 128 ; <i1> [#uses=1]
%min = select i1 %tmp130, i32 0, i32 127 ; <i32> [#uses=2]
%tmp143 = load i32* null ; <i32> [#uses=0]
br i1 false, label %bb303, label %bb314
cond_true166: ; preds = %bb303
ret int 0
ret i32 0
cond_false200: ; preds = %bb303
%tmp205 = sdiv int %min, 2 ; <int> [#uses=1]
%iftmp.380.0.p = select bool false, int 0, int %tmp205 ; <int> [#uses=0]
ret int 0
%tmp205 = sdiv i32 %min, 2 ; <i32> [#uses=1]
%iftmp.380.0.p = select i1 false, i32 0, i32 %tmp205 ; <i32> [#uses=0]
ret i32 0
bb303: ; preds = %cond_true114
%tmp165 = seteq int %min, 0 ; <bool> [#uses=1]
br bool %tmp165, label %cond_true166, label %cond_false200
bb309: ; preds = %bb19
br bool false, label %cond_true114, label %bb314
bb314: ; preds = %bb309
ret int 0
%tmp165 = icmp eq i32 %min, 0 ; <i1> [#uses=1]
br i1 %tmp165, label %cond_true166, label %cond_false200
bb309: ; preds = %entry
br i1 false, label %cond_true114, label %bb314
bb314: ; preds = %bb309, %cond_true114
ret i32 0
}

View File

@ -1,14 +1,13 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -predsimplify -disable-output
; RUN: llvm-as < %s | opt -predsimplify -disable-output
void %diff(int %N) {
define void @diff(i32 %N) {
entry:
%tmp = setgt int %N, 0 ; <bool> [#uses=1]
br bool %tmp, label %bb519, label %bb744
%tmp = icmp sgt i32 %N, 0 ; <i1> [#uses=1]
br i1 %tmp, label %bb519, label %bb744
bb519: ; preds = %entry
%tmp720101 = setlt int %N, 0 ; <bool> [#uses=1]
br bool %tmp720101, label %bb744, label %bb744
bb744: ; preds = %bb519, %entry
%tmp720101 = icmp slt i32 %N, 0 ; <i1> [#uses=1]
br i1 %tmp720101, label %bb744, label %bb744
bb744: ; preds = %bb519, %bb519, %entry
ret void
}

View File

@ -1,31 +1,25 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -predsimplify -disable-output
; RUN: llvm-as < %s | opt -predsimplify -disable-output
%struct.cube_struct = type { int, int, int, int*, int*, int*, int*, int*, uint*, uint*, uint**, uint**, uint*, uint*, uint, int, int*, int, int }
%cube = external global %struct.cube_struct ; <%struct.cube_struct*> [#uses=2]
%struct.cube_struct = type { i32, i32, i32, i32*, i32*, i32*, i32*, i32*, i32*, i32*, i32**, i32**, i32*, i32*, i32, i32, i32*, i32, i32 }
@cube = external global %struct.cube_struct ; <%struct.cube_struct*> [#uses=2]
implementation ; Functions:
fastcc void %cube_setup() {
define fastcc void @cube_setup() {
entry:
%tmp = load int* getelementptr (%struct.cube_struct* %cube, int 0, uint 2) ; <int> [#uses=2]
%tmp = setlt int %tmp, 0 ; <bool> [#uses=1]
br bool %tmp, label %bb, label %cond_next
%tmp = load i32* getelementptr (%struct.cube_struct* @cube, i32 0, i32 2) ; <i32> [#uses=2]
%tmp.upgrd.1 = icmp slt i32 %tmp, 0 ; <i1> [#uses=1]
br i1 %tmp.upgrd.1, label %bb, label %cond_next
cond_next: ; preds = %entry
%tmp2 = load int* getelementptr (%struct.cube_struct* %cube, int 0, uint 1) ; <int> [#uses=2]
%tmp5 = setlt int %tmp2, %tmp ; <bool> [#uses=1]
br bool %tmp5, label %bb, label %bb6
%tmp2 = load i32* getelementptr (%struct.cube_struct* @cube, i32 0, i32 1) ; <i32> [#uses=2]
%tmp5 = icmp slt i32 %tmp2, %tmp ; <i1> [#uses=1]
br i1 %tmp5, label %bb, label %bb6
bb: ; preds = %cond_next, %entry
unreachable
bb6: ; preds = %cond_next
%tmp98124 = setgt int %tmp2, 0 ; <bool> [#uses=1]
br bool %tmp98124, label %bb42, label %bb99
%tmp98124 = icmp sgt i32 %tmp2, 0 ; <i1> [#uses=1]
br i1 %tmp98124, label %bb42, label %bb99
bb42: ; preds = %bb6
ret void
bb99: ; preds = %bb6
ret void
}

View File

@ -1,54 +1,41 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -predsimplify -disable-output
; ModuleID = 'b.bc'
; RUN: llvm-as < %s | opt -predsimplify -disable-output
; END.
target datalayout = "e-p:32:32"
target endian = little
target pointersize = 32
target triple = "i686-pc-linux-gnu"
deplibs = [ "c", "crtend" ]
%struct.VDIR_ST = type { int, int, int, %struct.acl*, %struct.pfile*, %struct.vlink*, %struct.vlink*, %struct.vlink*, %struct.VDIR_ST*, %struct.VDIR_ST* }
%struct.acl = type { int, sbyte*, sbyte*, sbyte*, %struct.restrict*, %struct.acl*, %struct.acl* }
%struct.avalue = type { sbyte* }
%struct.pattrib = type { sbyte, sbyte*, sbyte*, %struct.avalue, %struct.pattrib*, %struct.pattrib* }
%struct.pfile = type { int, int, int, int, int, %struct.vlink*, %struct.vlink*, %struct.pattrib*, %struct.pfile*, %struct.pfile* }
%struct.VDIR_ST = type { i32, i32, i32, %struct.acl*, %struct.pfile*, %struct.vlink*, %struct.vlink*, %struct.vlink*, %struct.VDIR_ST*, %struct.VDIR_ST* }
%struct.acl = type { i32, i8*, i8*, i8*, %struct.restrict*, %struct.acl*, %struct.acl* }
%struct.avalue = type { i8* }
%struct.pattrib = type { i8, i8*, i8*, %struct.avalue, %struct.pattrib*, %struct.pattrib* }
%struct.pfile = type { i32, i32, i32, i32, i32, %struct.vlink*, %struct.vlink*, %struct.pattrib*, %struct.pfile*, %struct.pfile* }
%struct.restrict = type { %struct.acl*, %struct.acl* }
%struct.vlink = type { int, sbyte*, sbyte, int, sbyte*, %struct.vlink*, %struct.vlink*, sbyte*, sbyte*, sbyte*, sbyte*, int, int, %struct.acl*, int, int, sbyte*, %struct.pattrib*, %struct.pfile*, %struct.vlink*, %struct.vlink* }
%struct.vlink = type { i32, i8*, i8, i32, i8*, %struct.vlink*, %struct.vlink*, i8*, i8*, i8*, i8*, i32, i32, %struct.acl*, i32, i32, i8*, %struct.pattrib*, %struct.pfile*, %struct.vlink*, %struct.vlink* }
implementation ; Functions:
void %vl_insert(%struct.vlink* %vl) {
define void @vl_insert(%struct.vlink* %vl) {
entry:
%tmp91 = call int %vl_comp( ) ; <int> [#uses=2]
%tmp93 = setgt int %tmp91, 0 ; <bool> [#uses=1]
br bool %tmp93, label %cond_next84, label %bb94
%tmp91 = call i32 @vl_comp( ) ; <i32> [#uses=2]
%tmp93 = icmp sgt i32 %tmp91, 0 ; <i1> [#uses=1]
br i1 %tmp93, label %cond_next84, label %bb94
cond_next84: ; preds = %entry
ret void
bb94: ; preds = %entry
%tmp96 = seteq int %tmp91, 0 ; <bool> [#uses=1]
br bool %tmp96, label %cond_true97, label %cond_next203
%tmp96 = icmp eq i32 %tmp91, 0 ; <i1> [#uses=1]
br i1 %tmp96, label %cond_true97, label %cond_next203
cond_true97: ; preds = %bb94
br bool false, label %cond_next105, label %cond_true102
br i1 false, label %cond_next105, label %cond_true102
cond_true102: ; preds = %cond_true97
ret void
cond_next105: ; preds = %cond_true97
%tmp110 = getelementptr %struct.vlink* %vl, int 0, uint 12 ; <int*> [#uses=1]
%tmp111 = load int* %tmp110 ; <int> [#uses=1]
%tmp129 = seteq int %tmp111, 0 ; <bool> [#uses=1]
br bool %tmp129, label %cond_true130, label %cond_next133
%tmp110 = getelementptr %struct.vlink* %vl, i32 0, i32 12 ; <i32*> [#uses=1]
%tmp111 = load i32* %tmp110 ; <i32> [#uses=1]
%tmp129 = icmp eq i32 %tmp111, 0 ; <i1> [#uses=1]
br i1 %tmp129, label %cond_true130, label %cond_next133
cond_true130: ; preds = %cond_next105
ret void
cond_next133: ; preds = %cond_next105
ret void
cond_next203: ; preds = %bb94
ret void
}
declare int %vl_comp()
declare i32 @vl_comp()

View File

@ -1,19 +1,17 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -predsimplify -disable-output
; RUN: llvm-as < %s | opt -predsimplify -disable-output
void %ercMarkCurrMBConcealed(int %comp) {
define void @ercMarkCurrMBConcealed(i32 %comp) {
entry:
%tmp5 = icmp slt int %comp, 0 ; <bool> [#uses=2]
%comp_addr.0 = select bool %tmp5, int 0, int %comp ; <int> [#uses=1]
switch int %comp_addr.0, label %return [
int 0, label %bb
%tmp5 = icmp slt i32 %comp, 0 ; <i1> [#uses=2]
%comp_addr.0 = select i1 %tmp5, i32 0, i32 %comp ; <i32> [#uses=1]
switch i32 %comp_addr.0, label %return [
i32 0, label %bb
]
bb: ; preds = %entry
br bool %tmp5, label %bb87.bb97_crit_edge.critedge, label %return
br i1 %tmp5, label %bb87.bb97_crit_edge.critedge, label %return
bb87.bb97_crit_edge.critedge: ; preds = %bb
ret void
return: ; preds = %bb, %entry
ret void
}

View File

@ -1,309 +1,279 @@
; RUN: llvm-upgrade < %s | llvm-as | \
; RUN: llvm-as < %s | \
; RUN: opt -predsimplify -instcombine -simplifycfg | llvm-dis > %t
; RUN: grep -v declare %t | not grep fail
; RUN: grep -v declare %t | not grep fail
; RUN: grep -v declare %t | grep pass | count 4
void %test1(int %x) {
define void @test1(i32 %x) {
entry:
%A = seteq int %x, 0
br bool %A, label %then.1, label %else.1
then.1:
%B = seteq int %x, 1
br bool %B, label %then.2, label %else.1
then.2:
call void (...)* %fail( )
ret void
else.1:
ret void
%A = icmp eq i32 %x, 0 ; <i1> [#uses=1]
br i1 %A, label %then.1, label %else.1
then.1: ; preds = %entry
%B = icmp eq i32 %x, 1 ; <i1> [#uses=1]
br i1 %B, label %then.2, label %else.1
then.2: ; preds = %then.1
call void (...)* @fail( )
ret void
else.1: ; preds = %then.1, %entry
ret void
}
void %test2(int %x) {
define void @test2(i32 %x) {
entry:
%A = seteq int %x, 0
%B = seteq int %x, 1
br bool %A, label %then.1, label %else.1
then.1:
br bool %B, label %then.2, label %else.1
then.2:
call void (...)* %fail( )
ret void
else.1:
ret void
%A = icmp eq i32 %x, 0 ; <i1> [#uses=1]
%B = icmp eq i32 %x, 1 ; <i1> [#uses=1]
br i1 %A, label %then.1, label %else.1
then.1: ; preds = %entry
br i1 %B, label %then.2, label %else.1
then.2: ; preds = %then.1
call void (...)* @fail( )
ret void
else.1: ; preds = %then.1, %entry
ret void
}
void %test3(int %x) {
define void @test3(i32 %x) {
entry:
%A = seteq int %x, 0
%B = seteq int %x, 1
br bool %A, label %then.1, label %else.1
then.1:
br bool %B, label %then.2, label %else.1
then.2:
call void (...)* %fail( )
ret void
else.1:
ret void
%A = icmp eq i32 %x, 0 ; <i1> [#uses=1]
%B = icmp eq i32 %x, 1 ; <i1> [#uses=1]
br i1 %A, label %then.1, label %else.1
then.1: ; preds = %entry
br i1 %B, label %then.2, label %else.1
then.2: ; preds = %then.1
call void (...)* @fail( )
ret void
else.1: ; preds = %then.1, %entry
ret void
}
void %test4(int %x, int %y) {
define void @test4(i32 %x, i32 %y) {
entry:
%A = seteq int %x, 0
%B = seteq int %y, 0
%C = and bool %A, %B
br bool %C, label %then.1, label %else.1
then.1:
%D = seteq int %x, 0
br bool %D, label %then.2, label %else.2
then.2:
%E = seteq int %y, 0
br bool %E, label %else.1, label %else.2
else.1:
ret void
else.2:
call void (...)* %fail( )
ret void
%A = icmp eq i32 %x, 0 ; <i1> [#uses=1]
%B = icmp eq i32 %y, 0 ; <i1> [#uses=1]
%C = and i1 %A, %B ; <i1> [#uses=1]
br i1 %C, label %then.1, label %else.1
then.1: ; preds = %entry
%D = icmp eq i32 %x, 0 ; <i1> [#uses=1]
br i1 %D, label %then.2, label %else.2
then.2: ; preds = %then.1
%E = icmp eq i32 %y, 0 ; <i1> [#uses=1]
br i1 %E, label %else.1, label %else.2
else.1: ; preds = %then.2, %entry
ret void
else.2: ; preds = %then.2, %then.1
call void (...)* @fail( )
ret void
}
void %test5(int %x) {
define void @test5(i32 %x) {
entry:
%A = seteq int %x, 0
br bool %A, label %then.1, label %else.1
then.1:
ret void
then.2:
call void (...)* %fail( )
ret void
else.1:
%B = seteq int %x, 0
br bool %B, label %then.2, label %then.1
%A = icmp eq i32 %x, 0 ; <i1> [#uses=1]
br i1 %A, label %then.1, label %else.1
then.1: ; preds = %else.1, %entry
ret void
then.2: ; preds = %else.1
call void (...)* @fail( )
ret void
else.1: ; preds = %entry
%B = icmp eq i32 %x, 0 ; <i1> [#uses=1]
br i1 %B, label %then.2, label %then.1
}
void %test6(int %x, int %y) {
define void @test6(i32 %x, i32 %y) {
entry:
%A = seteq int %x, 0
%B = seteq int %y, 0
%C = or bool %A, %B
br bool %C, label %then.1, label %else.1
then.1:
ret void
then.2:
call void (...)* %fail( )
ret void
else.1:
%D = seteq int %x, 0
br bool %D, label %then.2, label %else.2
else.2:
%E = setne int %y, 0
br bool %E, label %then.1, label %then.2
%A = icmp eq i32 %x, 0 ; <i1> [#uses=1]
%B = icmp eq i32 %y, 0 ; <i1> [#uses=1]
%C = or i1 %A, %B ; <i1> [#uses=1]
br i1 %C, label %then.1, label %else.1
then.1: ; preds = %else.2, %entry
ret void
then.2: ; preds = %else.2, %else.1
call void (...)* @fail( )
ret void
else.1: ; preds = %entry
%D = icmp eq i32 %x, 0 ; <i1> [#uses=1]
br i1 %D, label %then.2, label %else.2
else.2: ; preds = %else.1
%E = icmp ne i32 %y, 0 ; <i1> [#uses=1]
br i1 %E, label %then.1, label %then.2
}
void %test7(int %x) {
define void @test7(i32 %x) {
entry:
%A = setne int %x, 0
%B = xor bool %A, true
br bool %B, label %then.1, label %else.1
then.1:
%C = seteq int %x, 1
br bool %C, label %then.2, label %else.1
then.2:
call void (...)* %fail( )
ret void
else.1:
ret void
%A = icmp ne i32 %x, 0 ; <i1> [#uses=1]
%B = xor i1 %A, true ; <i1> [#uses=1]
br i1 %B, label %then.1, label %else.1
then.1: ; preds = %entry
%C = icmp eq i32 %x, 1 ; <i1> [#uses=1]
br i1 %C, label %then.2, label %else.1
then.2: ; preds = %then.1
call void (...)* @fail( )
ret void
else.1: ; preds = %then.1, %entry
ret void
}
void %test8(int %x) {
define void @test8(i32 %x) {
entry:
%A = add int %x, 1
%B = seteq int %x, 0
br bool %B, label %then.1, label %then.2
then.1:
%C = seteq int %A, 1
br bool %C, label %then.2, label %else.2
then.2:
ret void
else.2:
call void (...)* %fail( )
ret void
%A = add i32 %x, 1 ; <i32> [#uses=1]
%B = icmp eq i32 %x, 0 ; <i1> [#uses=1]
br i1 %B, label %then.1, label %then.2
then.1: ; preds = %entry
%C = icmp eq i32 %A, 1 ; <i1> [#uses=1]
br i1 %C, label %then.2, label %else.2
then.2: ; preds = %then.1, %entry
ret void
else.2: ; preds = %then.1
call void (...)* @fail( )
ret void
}
void %test9(int %y, int %z) {
define void @test9(i32 %y, i32 %z) {
entry:
%x = add int %y, %z
%A = seteq int %y, 3
%B = seteq int %z, 5
%C = and bool %A, %B
br bool %C, label %cond_true, label %return
cond_true:
%D = seteq int %x, 8
br bool %D, label %then, label %oops
then:
call void (...)* %pass( )
ret void
oops:
call void (...)* %fail( )
ret void
return:
ret void
%x = add i32 %y, %z ; <i32> [#uses=1]
%A = icmp eq i32 %y, 3 ; <i1> [#uses=1]
%B = icmp eq i32 %z, 5 ; <i1> [#uses=1]
%C = and i1 %A, %B ; <i1> [#uses=1]
br i1 %C, label %cond_true, label %return
cond_true: ; preds = %entry
%D = icmp eq i32 %x, 8 ; <i1> [#uses=1]
br i1 %D, label %then, label %oops
then: ; preds = %cond_true
call void (...)* @pass( )
ret void
oops: ; preds = %cond_true
call void (...)* @fail( )
ret void
return: ; preds = %entry
ret void
}
void %test10() {
define void @test10() {
entry:
%A = alloca int
%B = seteq int* %A, null
br bool %B, label %cond_true, label %cond_false
cond_true:
call void (...)* %fail ( )
ret void
cond_false:
call void (...)* %pass ( )
ret void
%A = alloca i32 ; <i32*> [#uses=1]
%B = icmp eq i32* %A, null ; <i1> [#uses=1]
br i1 %B, label %cond_true, label %cond_false
cond_true: ; preds = %entry
call void (...)* @fail( )
ret void
cond_false: ; preds = %entry
call void (...)* @pass( )
ret void
}
void %switch1(int %x) {
define void @switch1(i32 %x) {
entry:
%A = seteq int %x, 10
br bool %A, label %return, label %cond_false
cond_false:
switch int %x, label %return [
int 9, label %then1
int 10, label %then2
]
then1:
call void (...)* %pass( )
ret void
then2:
call void (...)* %fail( )
ret void
return:
ret void
%A = icmp eq i32 %x, 10 ; <i1> [#uses=1]
br i1 %A, label %return, label %cond_false
cond_false: ; preds = %entry
switch i32 %x, label %return [
i32 9, label %then1
i32 10, label %then2
]
then1: ; preds = %cond_false
call void (...)* @pass( )
ret void
then2: ; preds = %cond_false
call void (...)* @fail( )
ret void
return: ; preds = %cond_false, %entry
ret void
}
void %switch2(int %x) {
define void @switch2(i32 %x) {
entry:
%A = seteq int %x, 10
br bool %A, label %return, label %cond_false
cond_false:
switch int %x, label %return [
int 8, label %then1
int 9, label %then1
int 10, label %then1
]
then1:
%B = setne int %x, 8
br bool %B, label %then2, label %return
then2:
call void (...)* %pass( )
ret void
return:
ret void
%A = icmp eq i32 %x, 10 ; <i1> [#uses=1]
br i1 %A, label %return, label %cond_false
cond_false: ; preds = %entry
switch i32 %x, label %return [
i32 8, label %then1
i32 9, label %then1
i32 10, label %then1
]
then1: ; preds = %cond_false, %cond_false, %cond_false
%B = icmp ne i32 %x, 8 ; <i1> [#uses=1]
br i1 %B, label %then2, label %return
then2: ; preds = %then1
call void (...)* @pass( )
ret void
return: ; preds = %then1, %cond_false, %entry
ret void
}
void %switch3(int %x) {
define void @switch3(i32 %x) {
entry:
%A = seteq int %x, 10
br bool %A, label %return, label %cond_false
cond_false:
switch int %x, label %return [
int 9, label %then1
int 10, label %then1
]
then1:
%B = seteq int %x, 9
br bool %B, label %return, label %oops
oops:
call void (...)* %fail( )
ret void
return:
ret void
%A = icmp eq i32 %x, 10 ; <i1> [#uses=1]
br i1 %A, label %return, label %cond_false
cond_false: ; preds = %entry
switch i32 %x, label %return [
i32 9, label %then1
i32 10, label %then1
]
then1: ; preds = %cond_false, %cond_false
%B = icmp eq i32 %x, 9 ; <i1> [#uses=1]
br i1 %B, label %return, label %oops
oops: ; preds = %then1
call void (...)* @fail( )
ret void
return: ; preds = %then1, %cond_false, %entry
ret void
}
void %switch4(int %x) {
define void @switch4(i32 %x) {
entry:
%A = seteq int %x, 10
br bool %A, label %then1, label %cond_false
cond_false:
switch int %x, label %default [
int 9, label %then1
int 10, label %then2
]
then1:
ret void
then2:
ret void
default:
%B = seteq int %x, 9
br bool %B, label %oops, label %then1
oops:
call void (...)* %fail( )
ret void
%A = icmp eq i32 %x, 10 ; <i1> [#uses=1]
br i1 %A, label %then1, label %cond_false
cond_false: ; preds = %entry
switch i32 %x, label %default [
i32 9, label %then1
i32 10, label %then2
]
then1: ; preds = %default, %cond_false, %entry
ret void
then2: ; preds = %cond_false
ret void
default: ; preds = %cond_false
%B = icmp eq i32 %x, 9 ; <i1> [#uses=1]
br i1 %B, label %oops, label %then1
oops: ; preds = %default
call void (...)* @fail( )
ret void
}
void %select1(int %x) {
define void @select1(i32 %x) {
entry:
%A = seteq int %x, 10
%B = select bool %A, int 1, int 2
%C = seteq int %B, 1
br bool %C, label %then, label %else
then:
br bool %A, label %return, label %oops
else:
br bool %A, label %oops, label %return
oops:
call void (...)* %fail( )
ret void
return:
ret void
%A = icmp eq i32 %x, 10 ; <i1> [#uses=3]
%B = select i1 %A, i32 1, i32 2 ; <i32> [#uses=1]
%C = icmp eq i32 %B, 1 ; <i1> [#uses=1]
br i1 %C, label %then, label %else
then: ; preds = %entry
br i1 %A, label %return, label %oops
else: ; preds = %entry
br i1 %A, label %oops, label %return
oops: ; preds = %else, %then
call void (...)* @fail( )
ret void
return: ; preds = %else, %then
ret void
}
void %select2(int %x) {
define void @select2(i32 %x) {
entry:
%A = seteq int %x, 10
%B = select bool %A, int 1, int 2
%C = seteq int %B, 1
br bool %A, label %then, label %else
then:
br bool %C, label %return, label %oops
else:
br bool %C, label %oops, label %return
oops:
call void (...)* %fail( )
ret void
return:
ret void
%A = icmp eq i32 %x, 10 ; <i1> [#uses=2]
%B = select i1 %A, i32 1, i32 2 ; <i32> [#uses=1]
%C = icmp eq i32 %B, 1 ; <i1> [#uses=2]
br i1 %A, label %then, label %else
then: ; preds = %entry
br i1 %C, label %return, label %oops
else: ; preds = %entry
br i1 %C, label %oops, label %return
oops: ; preds = %else, %then
call void (...)* @fail( )
ret void
return: ; preds = %else, %then
ret void
}
declare void %fail(...)
declare void @fail(...)
declare void %pass(...)
declare void @pass(...)

View File

@ -1,23 +1,20 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -predsimplify -verify
; RUN: llvm-as < %s | opt -predsimplify -verify
void %dgefa() {
define void @dgefa() {
entry:
br label %cond_true96
cond_true: ; preds = %cond_true96
%tmp19 = seteq int %tmp10, %k.0 ; <bool> [#uses=1]
br bool %tmp19, label %cond_next, label %cond_true20
cond_true20: ; preds = %cond_true
br label %cond_next
cond_next: ; preds = %cond_true20, %cond_true
%tmp84 = setgt int %tmp3, 1999 ; <bool> [#uses=0]
ret void
cond_true96: ; preds = %cond_true96, %entry
%k.0 = phi int [ 0, %entry ], [ 0, %cond_true96 ] ; <int> [#uses=3]
%tmp3 = add int %k.0, 1 ; <int> [#uses=1]
%tmp10 = add int 0, %k.0 ; <int> [#uses=1]
br bool false, label %cond_true96, label %cond_true
br label %cond_true96
cond_true: ; preds = %cond_true96
%tmp19 = icmp eq i32 %tmp10, %k.0 ; <i1> [#uses=1]
br i1 %tmp19, label %cond_next, label %cond_true20
cond_true20: ; preds = %cond_true
br label %cond_next
cond_next: ; preds = %cond_true20, %cond_true
%tmp84 = icmp sgt i32 %tmp3, 1999 ; <i1> [#uses=0]
ret void
cond_true96: ; preds = %cond_true96, %entry
%k.0 = phi i32 [ 0, %entry ], [ 0, %cond_true96 ] ; <i32> [#uses=3]
%tmp3 = add i32 %k.0, 1 ; <i32> [#uses=1]
%tmp10 = add i32 0, %k.0 ; <i32> [#uses=1]
br i1 false, label %cond_true96, label %cond_true
}

View File

@ -1,49 +1,37 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -predsimplify -verify
; ModuleID = 'bugpoint-reduced-simplified.bc'
target endian = little
target pointersize = 32
; RUN: llvm-as < %s | opt -predsimplify -verify
target datalayout = "e-p:32:32"
target triple = "i686-pc-linux-gnu"
deplibs = [ "c", "crtend" ]
%struct.anon = type { %struct.set_family*, %struct.set_family*, %struct.set_family*, sbyte*, int, uint*, %struct.pair_struct*, sbyte**, %struct.symbolic_t*, %struct.symbolic_t* }
%struct.pair_struct = type { int, int*, int* }
%struct.set_family = type { int, int, int, int, int, uint*, %struct.set_family* }
%struct.symbolic_label_t = type { sbyte*, %struct.symbolic_label_t* }
%struct.symbolic_list_t = type { int, int, %struct.symbolic_list_t* }
%struct.symbolic_t = type { %struct.symbolic_list_t*, int, %struct.symbolic_label_t*, int, %struct.symbolic_t* }
%struct.anon = type { %struct.set_family*, %struct.set_family*, %struct.set_family*, i8*, i32, i32*, %struct.pair_struct*, i8**, %struct.symbolic_t*, %struct.symbolic_t* }
%struct.pair_struct = type { i32, i32*, i32* }
%struct.set_family = type { i32, i32, i32, i32, i32, i32*, %struct.set_family* }
%struct.symbolic_label_t = type { i8*, %struct.symbolic_label_t* }
%struct.symbolic_list_t = type { i32, i32, %struct.symbolic_list_t* }
%struct.symbolic_t = type { %struct.symbolic_list_t*, i32, %struct.symbolic_label_t*, i32, %struct.symbolic_t* }
implementation ; Functions:
void %find_pairing_cost(int %strategy) {
define void @find_pairing_cost(i32 %strategy) {
entry:
br bool false, label %cond_true299, label %bb314
br i1 false, label %cond_true299, label %bb314
bb94: ; preds = %cond_true299
switch int %strategy, label %bb246 [
int 0, label %bb196
int 1, label %bb159
switch i32 %strategy, label %bb246 [
i32 0, label %bb196
i32 1, label %bb159
]
cond_next113: ; preds = %cond_true299
switch int %strategy, label %bb246 [
int 0, label %bb196
int 1, label %bb159
switch i32 %strategy, label %bb246 [
i32 0, label %bb196
i32 1, label %bb159
]
bb159: ; preds = %cond_next113, %bb94
ret void
bb196: ; preds = %cond_next113, %bb94
%Rsave.0.3 = phi %struct.set_family* [ null, %bb94 ], [ null, %cond_next113 ] ; <%struct.set_family*> [#uses=0]
ret void
bb246: ; preds = %cond_next113, %bb94
br label %bb314
cond_true299: ; preds = %entry
%tmp55 = setgt int %strategy, 0 ; <bool> [#uses=1]
br bool %tmp55, label %bb94, label %cond_next113
%tmp55 = icmp sgt i32 %strategy, 0 ; <i1> [#uses=1]
br i1 %tmp55, label %bb94, label %cond_next113
bb314: ; preds = %bb246, %entry
ret void
}

View File

@ -1,21 +1,22 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -predsimplify -simplifycfg | llvm-dis | grep pass
; RUN: llvm-as < %s | opt -predsimplify -simplifycfg | llvm-dis | grep pass
void %regtest(int %x) {
define void @regtest(i32 %x) {
entry:
%A = seteq int %x, 0
br bool %A, label %middle, label %after
middle:
br label %after
after:
%B = seteq int %x, 0
br bool %B, label %then, label %else
then:
br label %end
else:
call void (...)* %pass( )
br label %end
end:
ret void
%A = icmp eq i32 %x, 0 ; <i1> [#uses=1]
br i1 %A, label %middle, label %after
middle: ; preds = %entry
br label %after
after: ; preds = %middle, %entry
%B = icmp eq i32 %x, 0 ; <i1> [#uses=1]
br i1 %B, label %then, label %else
then: ; preds = %after
br label %end
else: ; preds = %after
call void (...)* @pass( )
br label %end
end: ; preds = %else, %then
ret void
}
declare void %pass(...)
declare void @pass(...)

View File

@ -1,36 +1,28 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -predsimplify -disable-output
; ModuleID = '<stdin>'
target endian = little
target pointersize = 32
; RUN: llvm-as < %s | opt -predsimplify -disable-output
target datalayout = "e-p:32:32"
target triple = "i686-pc-linux-gnu"
implementation ; Functions:
void %f(int %x, int %y) {
define void @f(i32 %x, i32 %y) {
entry:
%tmp = seteq int %x, 10 ; <bool> [#uses=1]
%tmp.not = xor bool %tmp, true ; <bool> [#uses=1]
%tmp3 = seteq int %x, %y ; <bool> [#uses=1]
%bothcond = and bool %tmp.not, %tmp3 ; <bool> [#uses=1]
br bool %bothcond, label %cond_true4, label %return
%tmp = icmp eq i32 %x, 10 ; <i1> [#uses=1]
%tmp.not = xor i1 %tmp, true ; <i1> [#uses=1]
%tmp3 = icmp eq i32 %x, %y ; <i1> [#uses=1]
%bothcond = and i1 %tmp.not, %tmp3 ; <i1> [#uses=1]
br i1 %bothcond, label %cond_true4, label %return
cond_true4: ; preds = %entry
switch int %y, label %return [
int 9, label %bb
int 10, label %bb6
switch i32 %y, label %return [
i32 9, label %bb
i32 10, label %bb6
]
bb: ; preds = %cond_true4
call void %g( int 9 )
call void @g( i32 9 )
ret void
bb6: ; preds = %cond_true4
call void %g( int 10 )
call void @g( i32 10 )
ret void
return: ; preds = %cond_true4, %entry
ret void
}
declare void %g(int)
declare void @g(i32)

View File

@ -1,11 +1,11 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -prune-eh | llvm-dis | grep invoke
; RUN: llvm-as < %s | opt -prune-eh | llvm-dis | grep invoke
declare void %External()
declare void @External()
implementation
void %foo() {
invoke void %External() to label %Cont except label %Cont
Cont:
define void @foo() {
invoke void @External( )
to label %Cont unwind label %Cont
Cont: ; preds = %0, %0
ret void
}

View File

@ -1,15 +1,15 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -prune-eh -disable-output
; RUN: llvm-as < %s | opt -prune-eh -disable-output
implementation
internal void %callee() { ; does not throw
ret void
define internal void @callee() {
ret void
}
int %caller() {
invoke void %callee() to label %E except label %E
E:
%X = phi int [0, %0], [0, %0]
ret int %X
define i32 @caller() {
; <label>:0
invoke void @callee( )
to label %E unwind label %E
E: ; preds = %0, %0
%X = phi i32 [ 0, %0 ], [ 0, %0 ] ; <i32> [#uses=1]
ret i32 %X
}

View File

@ -1,19 +1,20 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -prune-eh | llvm-dis | not grep invoke
; RUN: llvm-as < %s | opt -prune-eh | llvm-dis | not grep invoke
implementation
internal int %foo() {
invoke int %foo() to label %Normal except label %Except
Normal:
ret int 12
Except:
ret int 123
define internal i32 @foo() {
invoke i32 @foo( )
to label %Normal unwind label %Except ; <i32>:1 [#uses=0]
Normal: ; preds = %0
ret i32 12
Except: ; preds = %0
ret i32 123
}
int %caller() {
invoke int %foo() to label %Normal except label %Except
Normal:
ret int 0
Except:
ret int 1
define i32 @caller() {
invoke i32 @foo( )
to label %Normal unwind label %Except ; <i32>:1 [#uses=0]
Normal: ; preds = %0
ret i32 0
Except: ; preds = %0
ret i32 1
}

View File

@ -1,10 +1,10 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -raiseallocs -disable-output
implementation ; Functions:
; RUN: llvm-as < %s | opt -raiseallocs -disable-output
void %main() {
%tmp.13 = call int (...)* %free( int 32 )
%tmp.14 = cast int %tmp.13 to int*
define void @main() {
%tmp.13 = call i32 (...)* @free( i32 32 ) ; <i32> [#uses=1]
%tmp.14 = inttoptr i32 %tmp.13 to i32* ; <i32*> [#uses=0]
ret void
}
declare int %free(...)
declare i32 @free(...)

View File

@ -1,10 +1,11 @@
; This situation can occur due to the funcresolve pass.
;
; RUN: llvm-upgrade < %s | llvm-as | opt -raiseallocs | llvm-dis | not grep call
; RUN: llvm-as < %s | opt -raiseallocs | llvm-dis | not grep call
declare void %free(sbyte*)
declare void @free(i8*)
void %test(int *%P) {
call void(int*)* cast (void(sbyte*)* %free to void(int*)*)(int* %P)
ret void
define void @test(i32* %P) {
call void bitcast (void (i8*)* @free to void (i32*)*)( i32* %P )
ret void
}

View File

@ -1,79 +1,79 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | \
; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
; RUN: not grep {call void %DEAD}
; Test that we can thread a simple known condition through switch statements.
declare void %foo1()
declare void %foo2()
declare void %DEAD()
declare void @foo1()
void %test1(uint %V) {
switch uint %V, label %A [
uint 4, label %T
uint 17, label %Done
uint 1234, label %A
declare void @foo2()
declare void @DEAD()
define void @test1(i32 %V) {
switch i32 %V, label %A [
i32 4, label %T
i32 17, label %Done
i32 1234, label %A
]
T: ;; V == 4 if we get here.
call void %foo1()
;; V == 4 if we get here.
T: ; preds = %0
call void @foo1( )
;; This switch is always statically determined.
switch uint %V, label %A2 [
uint 4, label %B
uint 17, label %C
uint 42, label %C
switch i32 %V, label %A2 [
i32 4, label %B
i32 17, label %C
i32 42, label %C
]
A2:
call void %DEAD()
call void %DEAD()
%cond2 = seteq uint %V, 4 ;; always false
br bool %cond2, label %Done, label %C
A:
call void %foo1()
%cond = setne uint %V, 4 ;; always true
br bool %cond, label %Done, label %C
Done:
A2: ; preds = %T
call void @DEAD( )
call void @DEAD( )
;; always true
%cond2 = icmp eq i32 %V, 4 ; <i1> [#uses=1]
br i1 %cond2, label %Done, label %C
A: ; preds = %0, %0
call void @foo1( )
;; always true
%cond = icmp ne i32 %V, 4 ; <i1> [#uses=1]
br i1 %cond, label %Done, label %C
Done: ; preds = %B, %A, %A2, %0
ret void
B:
call void %foo2()
%cond3 = seteq uint %V, 4 ;; always true
br bool %cond3, label %Done, label %C
C:
call void %DEAD()
ret void
}
void %test2(uint %V) {
switch uint %V, label %A [
uint 4, label %T
uint 17, label %D
uint 1234, label %E
]
A: ;; V != 4, 17, 1234 here.
call void %foo1()
;; This switch is always statically determined.
switch uint %V, label %E [
uint 4, label %C
uint 17, label %C
uint 42, label %D
]
C:
call void %DEAD() ;; unreacahble.
ret void
T:
call void %foo1()
call void %foo1()
ret void
D:
call void %foo1()
ret void
E:
B: ; preds = %T
call void @foo2( )
;; always true
%cond3 = icmp eq i32 %V, 4 ; <i1> [#uses=1]
br i1 %cond3, label %Done, label %C
C: ; preds = %B, %A, %A2, %T, %T
call void @DEAD( )
ret void
}
define void @test2(i32 %V) {
switch i32 %V, label %A [
i32 4, label %T
i32 17, label %D
i32 1234, label %E
]
;; V != 4, 17, 1234 here.
A: ; preds = %0
call void @foo1( )
;; This switch is always statically determined.
switch i32 %V, label %E [
i32 4, label %C
i32 17, label %C
i32 42, label %D
]
;; unreacahble.
C: ; preds = %A, %A
call void @DEAD( )
ret void
T: ; preds = %0
call void @foo1( )
call void @foo1( )
ret void
D: ; preds = %A, %0
call void @foo1( )
ret void
E: ; preds = %A, %0
ret void
}