Start doing the significantly useful part of jump threading: handle cases
where a comparison has a phi input and that phi is a constant. For example,
stuff like:
Threading edge through bool from 'bb2149' to 'bb2231' with cost: 1, across block:
bb2237: ; preds = %bb2231, %bb2149
%tmp2328.rle = phi i32 [ %tmp2232, %bb2231 ], [ %tmp2232439, %bb2149 ] ; <i32> [#uses=2]
%done.0 = phi i32 [ %done.2, %bb2231 ], [ 0, %bb2149 ] ; <i32> [#uses=1]
%tmp2239 = icmp eq i32 %done.0, 0 ; <i1> [#uses=1]
br i1 %tmp2239, label %bb2231, label %bb2327
or
bb38.i298: ; preds = %bb33.i295, %bb1693
%tmp39.i296.rle = phi %struct.ibox* [ null, %bb1693 ], [ %tmp39.i296.rle1109, %bb33.i295 ] ; <%struct.ibox*> [#uses=2]
%minspan.1.i291.reg2mem.1 = phi i32 [ 32000, %bb1693 ], [ %minspan.0.i288, %bb33.i295 ] ; <i32> [#uses=1]
%tmp40.i297 = icmp eq %struct.ibox* %tmp39.i296.rle, null ; <i1> [#uses=1]
br i1 %tmp40.i297, label %implfeeds.exit311, label %bb43.i301
This triggers thousands of times in spec.
llvm-svn: 50110
2008-04-22 23:40:39 +02:00
|
|
|
; There should be no phi nodes left.
|
2009-10-11 05:54:21 +02:00
|
|
|
; RUN: opt < %s -jump-threading -S | not grep {phi i32}
|
Start doing the significantly useful part of jump threading: handle cases
where a comparison has a phi input and that phi is a constant. For example,
stuff like:
Threading edge through bool from 'bb2149' to 'bb2231' with cost: 1, across block:
bb2237: ; preds = %bb2231, %bb2149
%tmp2328.rle = phi i32 [ %tmp2232, %bb2231 ], [ %tmp2232439, %bb2149 ] ; <i32> [#uses=2]
%done.0 = phi i32 [ %done.2, %bb2231 ], [ 0, %bb2149 ] ; <i32> [#uses=1]
%tmp2239 = icmp eq i32 %done.0, 0 ; <i1> [#uses=1]
br i1 %tmp2239, label %bb2231, label %bb2327
or
bb38.i298: ; preds = %bb33.i295, %bb1693
%tmp39.i296.rle = phi %struct.ibox* [ null, %bb1693 ], [ %tmp39.i296.rle1109, %bb33.i295 ] ; <%struct.ibox*> [#uses=2]
%minspan.1.i291.reg2mem.1 = phi i32 [ 32000, %bb1693 ], [ %minspan.0.i288, %bb33.i295 ] ; <i32> [#uses=1]
%tmp40.i297 = icmp eq %struct.ibox* %tmp39.i296.rle, null ; <i1> [#uses=1]
br i1 %tmp40.i297, label %implfeeds.exit311, label %bb43.i301
This triggers thousands of times in spec.
llvm-svn: 50110
2008-04-22 23:40:39 +02:00
|
|
|
|
|
|
|
declare i32 @f1()
|
|
|
|
declare i32 @f2()
|
|
|
|
declare void @f3()
|
|
|
|
|
|
|
|
define i32 @test(i1 %cond) {
|
|
|
|
br i1 %cond, label %T1, label %F1
|
|
|
|
|
|
|
|
T1:
|
|
|
|
%v1 = call i32 @f1()
|
|
|
|
br label %Merge
|
|
|
|
|
|
|
|
F1:
|
|
|
|
%v2 = call i32 @f2()
|
|
|
|
br label %Merge
|
|
|
|
|
|
|
|
Merge:
|
|
|
|
%B = phi i32 [%v1, %T1], [12, %F1]
|
|
|
|
%A = icmp ne i32 %B, 42
|
|
|
|
br i1 %A, label %T2, label %F2
|
|
|
|
|
|
|
|
T2:
|
|
|
|
call void @f3()
|
|
|
|
ret i32 1
|
|
|
|
|
|
|
|
F2:
|
|
|
|
ret i32 0
|
|
|
|
}
|