remove predicate simplifier, it never got the last bugs beaten

out of it, and jump threading, condprop and gvn are now getting
most of the benefit.  This was approved by Nicholas and Nicolas.

llvm-svn: 83390
This commit is contained in:
Chris Lattner 2009-10-06 16:59:46 +00:00
parent 90a7ea5c13
commit e87add4b88
23 changed files with 0 additions and 3542 deletions

View File

@ -118,7 +118,6 @@ namespace {
(void) llvm::createRSProfilingPass();
(void) llvm::createIndMemRemPass();
(void) llvm::createInstCountPass();
(void) llvm::createPredicateSimplifierPass();
(void) llvm::createCodeGenLICMPass();
(void) llvm::createCodeGenPreparePass();
(void) llvm::createGVNPass();

View File

@ -276,13 +276,6 @@ FunctionPass *createBlockPlacementPass();
Pass *createLCSSAPass();
extern const PassInfo *const LCSSAID;
//===----------------------------------------------------------------------===//
//
// PredicateSimplifier - This pass collapses duplicate variables into one
// canonical form, and tries to simplify expressions along the way.
//
FunctionPass *createPredicateSimplifierPass();
//===----------------------------------------------------------------------===//
//
// GVN - This pass performs global value numbering and redundant load

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +0,0 @@
; RUN: opt < %s -predsimplify -disable-output
define fastcc void @_ov_splice(i32 %n1, i32 %n2, i32 %ch2) {
entry:
%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 = 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,23 +0,0 @@
; RUN: opt < %s -predsimplify -disable-output
define void @safe_strcpy(i32 %size1) {
entry:
%tmp = icmp eq i32 %size1, 0 ; <i1> [#uses=1]
br i1 %tmp, label %return, label %strlen.exit
strlen.exit: ; preds = %entry
%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 = 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,24 +0,0 @@
; RUN: opt < %s -predsimplify -disable-output
define void @gs_image_next() {
entry:
%tmp = load i32* null ; <i32> [#uses=2]
br i1 false, label %cond_next21, label %UnifiedReturnBlock
cond_next21: ; preds = %entry
br i1 false, label %cond_next42, label %UnifiedReturnBlock
cond_next42: ; preds = %cond_next21
br label %cond_true158
cond_next134: ; preds = %cond_true158
%tmp1571 = icmp eq i32 0, %min ; <i1> [#uses=0]
ret void
cond_true158: ; preds = %cond_true158, %cond_next42
%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,46 +0,0 @@
; RUN: opt < %s -predsimplify -S | grep br | grep return.i.bb8_crit_edge | grep false
@str = external global [4 x i8] ; <[4 x i8]*> [#uses=1]
declare i32 @sprintf(i8*, i8*, ...)
define i32 @main() {
entry:
br label %cond_true.outer
cond_true.outer: ; preds = %cond_true.i, %entry
%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 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.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( 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 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 i32 @printf(i8*, ...)
declare i8* @llvm.stacksave()
declare void @llvm.stackrestore(i8*)

View File

@ -1,47 +0,0 @@
; RUN: opt < %s -predsimplify -instcombine -simplifycfg -S > %t
; RUN: grep -v declare %t | not grep fail
; RUN: grep -v declare %t | grep pass | count 3
define i32 @test1(i32 %x, i32 %y) {
entry:
%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 = icmp eq i32 %x, 0 ; <i1> [#uses=1]
br i1 %tmp4, label %cond_true5, label %cond_false
cond_true5: ; preds = %cond_true
%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
}
define i32 @test2(i32 %x, i32 %y) {
entry:
%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 = icmp eq i32 %x, 0 ; <i1> [#uses=1]
br i1 %tmp4, label %cond_true5, label %cond_false
cond_true5: ; preds = %cond_true
%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 i32 @fail()
declare i32 @pass()
declare i32 @pass1()
declare i32 @pass2()

View File

@ -1,25 +0,0 @@
; RUN: opt < %s -predsimplify -instcombine -simplifycfg -S | \
; RUN: grep -v declare | grep pass | count 2
define i32 @test(i32 %x, i32 %y) {
entry:
%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 = icmp eq i32 %x, %y ; <i1> [#uses=1]
br i1 %tmp4, label %cond_true5, label %cond_false
cond_true5: ; preds = %cond_true
%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 i32 @pass1()
declare i32 @pass2()

View File

@ -1,16 +0,0 @@
; RUN: opt < %s -predsimplify -disable-output
define void @readMotionInfoFromNAL() {
entry:
br i1 false, label %bb2425, label %cond_next30
cond_next30: ; preds = %entry
ret void
bb2418: ; preds = %bb2425
ret void
bb2425: ; preds = %entry
%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,25 +0,0 @@
; RUN: opt < %s -predsimplify -disable-output
define i32 @test_wp_B_slice(i32 %select_method) {
entry:
br label %bb309
cond_true114: ; preds = %bb309
%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 i32 0
cond_false200: ; preds = %bb303
%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 = 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,13 +0,0 @@
; RUN: opt < %s -predsimplify -disable-output
define void @diff(i32 %N) {
entry:
%tmp = icmp sgt i32 %N, 0 ; <i1> [#uses=1]
br i1 %tmp, label %bb519, label %bb744
bb519: ; preds = %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,25 +0,0 @@
; RUN: opt < %s -predsimplify -disable-output
%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]
define fastcc void @cube_setup() {
entry:
%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 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 = 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,41 +0,0 @@
; RUN: opt < %s -predsimplify -disable-output
; END.
target datalayout = "e-p:32:32"
target triple = "i686-pc-linux-gnu"
deplibs = [ "c", "crtend" ]
%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 { 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* }
define void @vl_insert(%struct.vlink* %vl) {
entry:
%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 = icmp eq i32 %tmp91, 0 ; <i1> [#uses=1]
br i1 %tmp96, label %cond_true97, label %cond_next203
cond_true97: ; preds = %bb94
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, 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 i32 @vl_comp()

View File

@ -1,17 +0,0 @@
; RUN: opt < %s -predsimplify -disable-output
define void @ercMarkCurrMBConcealed(i32 %comp) {
entry:
%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 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,19 +0,0 @@
; RUN: opt < %s -predsimplify -S | grep -v %c
define void @foo(i8* %X, i8* %Y) {
entry:
%A = load i8* %X
%B = load i8* %Y
%a = icmp ult i8 %B, 10
br i1 %a, label %cond_true, label %URB
cond_true:
%b = icmp eq i8 %A, %B
br i1 %b, label %cond_true2, label %URB
cond_true2:
%c = icmp ult i8 %A, 11
call i8 @bar(i1 %c)
ret void
URB:
ret void
}
declare i8 @bar(i1)

View File

@ -1,102 +0,0 @@
; RUN: opt < %s -predsimplify -S | grep unreachable | count 2
; PR1683
@.str = internal constant [13 x i8] c"c36174a.adb\00\00" ; <[13 x i8]*> [#uses=1]
define void @_ada_c36174a() {
entry:
%tmp3 = call i8* @llvm.stacksave( ) ; <i8*> [#uses=1]
%tmp4 = invoke i32 @report__ident_int( i32 6 )
to label %invcont unwind label %entry.lpad_crit_edge ; <i32> [#uses=7]
entry.lpad_crit_edge: ; preds = %entry
br label %lpad
invcont: ; preds = %entry
%tmp6 = icmp slt i32 %tmp4, 1 ; <i1> [#uses=1]
br i1 %tmp6, label %bb, label %bb9
bb: ; preds = %invcont
invoke void @__gnat_rcheck_07( i8* getelementptr ([13 x i8]* @.str, i32 0, i32 0), i32 10 )
to label %invcont8 unwind label %bb.lpad_crit_edge
bb.lpad_crit_edge: ; preds = %bb
br label %lpad
invcont8: ; preds = %bb
unreachable
bb9: ; preds = %invcont
%tmp51 = add i32 %tmp4, 6 ; <i32> [#uses=2]
%tmp56 = icmp sgt i32 %tmp4, %tmp51 ; <i1> [#uses=1]
br i1 %tmp56, label %bb9.bb76_crit_edge, label %bb9.bb61_crit_edge
bb9.bb61_crit_edge: ; preds = %bb9
br label %bb61
bb9.bb76_crit_edge: ; preds = %bb9
br label %bb76
bb61: ; preds = %bb73, %bb9.bb61_crit_edge
%J4b.0 = phi i32 [ %tmp75, %bb73 ], [ %tmp4, %bb9.bb61_crit_edge ] ; <i32> [#uses=2]
%tmp70 = icmp eq i32 %tmp51, %J4b.0 ; <i1> [#uses=1]
br i1 %tmp70, label %bb61.bb76_crit_edge, label %bb73
bb61.bb76_crit_edge: ; preds = %bb61
br label %bb76
bb73: ; preds = %bb61
%tmp75 = add i32 %J4b.0, 1 ; <i32> [#uses=1]
br label %bb61
bb76: ; preds = %bb61.bb76_crit_edge, %bb9.bb76_crit_edge
%tmp78 = icmp ne i32 %tmp4, 6 ; <i1> [#uses=1]
%tmp81 = add i32 %tmp4, 6 ; <i32> [#uses=1]
%tmp8182 = sext i32 %tmp81 to i64 ; <i64> [#uses=1]
%tmp8384 = sext i32 %tmp4 to i64 ; <i64> [#uses=1]
%tmp85 = sub i64 %tmp8182, %tmp8384 ; <i64> [#uses=1]
%tmp86 = icmp ne i64 %tmp85, 6 ; <i1> [#uses=1]
%tmp90 = or i1 %tmp78, %tmp86 ; <i1> [#uses=1]
br i1 %tmp90, label %bb93, label %bb76.bb99_crit_edge
bb76.bb99_crit_edge: ; preds = %bb76
br label %bb99
bb93: ; preds = %bb76
invoke void @abort( )
to label %bb93.bb99_crit_edge unwind label %bb93.lpad_crit_edge
bb93.lpad_crit_edge: ; preds = %bb93
br label %lpad
bb93.bb99_crit_edge: ; preds = %bb93
br label %bb99
bb99: ; preds = %bb93.bb99_crit_edge, %bb76.bb99_crit_edge
ret void
lpad: ; preds = %bb93.lpad_crit_edge, %bb.lpad_crit_edge, %entry.lpad_crit_edge
%eh_ptr = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2]
%eh_select102 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32 0 ) ; <i32> [#uses=0]
call void @llvm.stackrestore( i8* %tmp3 )
call i32 (...)* @_Unwind_Resume( i8* %eh_ptr ) ; <i32>:0 [#uses=0]
unreachable
}
declare i8* @llvm.stacksave()
declare i32 @report__ident_int(i32)
declare void @__gnat_rcheck_07(i8*, i32)
declare void @abort()
declare i8* @llvm.eh.exception()
declare i32 @llvm.eh.selector.i32(i8*, i8*, ...)
declare i32 @__gnat_eh_personality(...)
declare i32 @_Unwind_Resume(...)
declare void @llvm.stackrestore(i8*)

View File

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

View File

@ -1,278 +0,0 @@
; RUN: opt < %s -predsimplify -instcombine -simplifycfg -S > %t
; RUN: grep -v declare %t | not grep fail
; RUN: grep -v declare %t | grep pass | count 4
define void @test1(i32 %x) {
entry:
%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
}
define void @test2(i32 %x) {
entry:
%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
}
define void @test3(i32 %x) {
entry:
%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
}
define void @test4(i32 %x, i32 %y) {
entry:
%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
}
define void @test5(i32 %x) {
entry:
%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
}
define void @test6(i32 %x, i32 %y) {
entry:
%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
}
define void @test7(i32 %x) {
entry:
%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
}
define void @test8(i32 %x) {
entry:
%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
}
define void @test9(i32 %y, i32 %z) {
entry:
%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
}
define void @test10() {
entry:
%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
}
define void @switch1(i32 %x) {
entry:
%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
}
define void @switch2(i32 %x) {
entry:
%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
}
define void @switch3(i32 %x) {
entry:
%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
}
define void @switch4(i32 %x) {
entry:
%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
}
define void @select1(i32 %x) {
entry:
%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
}
define void @select2(i32 %x) {
entry:
%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 @pass(...)

View File

@ -1,20 +0,0 @@
; RUN: opt < %s -predsimplify -verify
define void @dgefa() {
entry:
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,37 +0,0 @@
; RUN: opt < %s -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*, 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* }
define void @find_pairing_cost(i32 %strategy) {
entry:
br i1 false, label %cond_true299, label %bb314
bb94: ; preds = %cond_true299
switch i32 %strategy, label %bb246 [
i32 0, label %bb196
i32 1, label %bb159
]
cond_next113: ; preds = %cond_true299
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 = 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,22 +0,0 @@
; RUN: opt < %s -predsimplify -simplifycfg -S | grep pass
define void @regtest(i32 %x) {
entry:
%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(...)

View File

@ -1,28 +0,0 @@
; RUN: opt < %s -predsimplify -disable-output
target datalayout = "e-p:32:32"
target triple = "i686-pc-linux-gnu"
define void @f(i32 %x, i32 %y) {
entry:
%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 i32 %y, label %return [
i32 9, label %bb
i32 10, label %bb6
]
bb: ; preds = %cond_true4
call void @g( i32 9 )
ret void
bb6: ; preds = %cond_true4
call void @g( i32 10 )
ret void
return: ; preds = %cond_true4, %entry
ret void
}
declare void @g(i32)