mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Remove llvm-upgrade and update tests.
llvm-svn: 48527
This commit is contained in:
parent
e9aa507edc
commit
0721aaa8f7
@ -1,22 +1,18 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -licm -disable-output
|
||||
; RUN: llvm-as < %s | opt -basicaa -licm -disable-output
|
||||
|
||||
;%MoveArray = external global [64 x ulong]
|
||||
|
||||
implementation ; Functions:
|
||||
|
||||
void %InitMoveArray() {
|
||||
bb3: ; No predecessors!
|
||||
%X = alloca [2 x ulong]
|
||||
br bool false, label %bb13, label %bb4
|
||||
|
||||
define void @InitMoveArray() {
|
||||
bb3:
|
||||
%X = alloca [2 x i64] ; <[2 x i64]*> [#uses=1]
|
||||
br i1 false, label %bb13, label %bb4
|
||||
bb4: ; preds = %bb3
|
||||
%reg3011 = getelementptr [2 x ulong]* %X, long 0, long 0
|
||||
%reg3011 = getelementptr [2 x i64]* %X, i64 0, i64 0 ; <i64*> [#uses=1]
|
||||
br label %bb8
|
||||
|
||||
bb8: ; preds = %bb8, %bb4
|
||||
store ulong 0, ulong* %reg3011
|
||||
br bool false, label %bb8, label %bb13
|
||||
|
||||
store i64 0, i64* %reg3011
|
||||
br i1 false, label %bb8, label %bb13
|
||||
bb13: ; preds = %bb8, %bb3
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -1,22 +1,17 @@
|
||||
; Exit blocks need to be updated for all nested loops...
|
||||
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -loopsimplify
|
||||
|
||||
implementation ; Functions:
|
||||
|
||||
int %yyparse() {
|
||||
bb0: ; No predecessors!
|
||||
br bool false, label %UnifiedExitNode, label %bb19
|
||||
; RUN: llvm-as < %s | opt -loopsimplify
|
||||
|
||||
define i32 @yyparse() {
|
||||
bb0:
|
||||
br i1 false, label %UnifiedExitNode, label %bb19
|
||||
bb19: ; preds = %bb28, %bb0
|
||||
br bool false, label %bb28, label %UnifiedExitNode
|
||||
|
||||
br i1 false, label %bb28, label %UnifiedExitNode
|
||||
bb28: ; preds = %bb32, %bb19
|
||||
br bool false, label %bb32, label %bb19
|
||||
|
||||
br i1 false, label %bb32, label %bb19
|
||||
bb32: ; preds = %bb28
|
||||
br bool false, label %UnifiedExitNode, label %bb28
|
||||
|
||||
br i1 false, label %UnifiedExitNode, label %bb28
|
||||
UnifiedExitNode: ; preds = %bb32, %bb19, %bb0
|
||||
ret int 0
|
||||
ret i32 0
|
||||
}
|
||||
|
||||
|
@ -1,19 +1,16 @@
|
||||
; This testcase fails because preheader insertion is not updating exit node
|
||||
; information for loops.
|
||||
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm
|
||||
; RUN: llvm-as < %s | opt -licm
|
||||
|
||||
int %main(int %argc, sbyte** %argv) {
|
||||
bb0: ; No predecessors!
|
||||
br bool false, label %bb7, label %bb5
|
||||
|
||||
bb5: ; preds = %bb5, %bb0
|
||||
br bool false, label %bb5, label %bb7
|
||||
|
||||
bb7: ; preds = %bb7, %bb5, %bb0
|
||||
br bool false, label %bb7, label %bb10
|
||||
|
||||
bb10: ; preds = %bb7
|
||||
ret int 0
|
||||
define i32 @main(i32 %argc, i8** %argv) {
|
||||
bb0:
|
||||
br i1 false, label %bb7, label %bb5
|
||||
bb5: ; preds = %bb5, %bb0
|
||||
br i1 false, label %bb5, label %bb7
|
||||
bb7: ; preds = %bb7, %bb5, %bb0
|
||||
br i1 false, label %bb7, label %bb10
|
||||
bb10: ; preds = %bb7
|
||||
ret i32 0
|
||||
}
|
||||
|
||||
|
@ -3,24 +3,22 @@
|
||||
; happens because preheader insertion doesn't insert a preheader for this
|
||||
; case... bad.
|
||||
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm -adce -simplifycfg | llvm-dis | \
|
||||
; RUN: llvm-as < %s | opt -licm -adce -simplifycfg | llvm-dis | \
|
||||
; RUN: not grep {br }
|
||||
|
||||
int %main(int %argc) {
|
||||
br label %bb5
|
||||
|
||||
bb5: ; preds = %bb5, %0
|
||||
%I = phi int [0, %0], [%I2, %bb5]
|
||||
%I2 = add int %I, 1
|
||||
%c = seteq int %I2, 10
|
||||
br bool %c, label %bb5, label %bb8
|
||||
|
||||
bb8: ; preds = %bb8, %bb5
|
||||
%cann-indvar = phi uint [ 0, %bb8 ], [ 0, %bb5 ]
|
||||
%X = add int %argc, %argc ; Loop invariant
|
||||
br bool false, label %bb8, label %bb10
|
||||
|
||||
bb10: ; preds = %bb8
|
||||
ret int %X
|
||||
define i32 @main(i32 %argc) {
|
||||
; <label>:0
|
||||
br label %bb5
|
||||
bb5: ; preds = %bb5, %0
|
||||
%I = phi i32 [ 0, %0 ], [ %I2, %bb5 ] ; <i32> [#uses=1]
|
||||
%I2 = add i32 %I, 1 ; <i32> [#uses=2]
|
||||
%c = icmp eq i32 %I2, 10 ; <i1> [#uses=1]
|
||||
br i1 %c, label %bb5, label %bb8
|
||||
bb8: ; preds = %bb8, %bb5
|
||||
%cann-indvar = phi i32 [ 0, %bb8 ], [ 0, %bb5 ] ; <i32> [#uses=0]
|
||||
%X = add i32 %argc, %argc ; <i32> [#uses=1]
|
||||
br i1 false, label %bb8, label %bb10
|
||||
bb10: ; preds = %bb8
|
||||
ret i32 %X
|
||||
}
|
||||
|
||||
|
@ -1,13 +1,15 @@
|
||||
; LICM is adding stores before phi nodes. bad.
|
||||
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm
|
||||
; RUN: llvm-as < %s | opt -licm
|
||||
|
||||
bool %test(bool %c) {
|
||||
br bool %c, label %Loop, label %Out
|
||||
Loop:
|
||||
store int 0, int* null
|
||||
br bool %c, label %Loop, label %Out
|
||||
Out:
|
||||
%X = phi bool [%c, %0], [true, %Loop]
|
||||
ret bool %X
|
||||
define i1 @test(i1 %c) {
|
||||
; <label>:0
|
||||
br i1 %c, label %Loop, label %Out
|
||||
Loop: ; preds = %Loop, %0
|
||||
store i32 0, i32* null
|
||||
br i1 %c, label %Loop, label %Out
|
||||
Out: ; preds = %Loop, %0
|
||||
%X = phi i1 [ %c, %0 ], [ true, %Loop ] ; <i1> [#uses=1]
|
||||
ret i1 %X
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
; Test that hoisting is disabled for pointers of different types...
|
||||
;
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm
|
||||
; RUN: llvm-as < %s | opt -licm
|
||||
|
||||
void %test(int* %P) {
|
||||
define void @test(i32* %P) {
|
||||
br label %Loop
|
||||
Loop:
|
||||
store int 5, int* %P
|
||||
%P2 = cast int* %P to sbyte*
|
||||
store sbyte 4, sbyte* %P2
|
||||
br bool true, label %Loop, label %Out
|
||||
Out:
|
||||
Loop: ; preds = %Loop, %0
|
||||
store i32 5, i32* %P
|
||||
%P2 = bitcast i32* %P to i8* ; <i8*> [#uses=1]
|
||||
store i8 4, i8* %P2
|
||||
br i1 true, label %Loop, label %Out
|
||||
Out: ; preds = %Loop
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -3,19 +3,21 @@
|
||||
; loaded from. Basically if the load gets hoisted, the subtract gets turned
|
||||
; into a constant zero.
|
||||
;
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm -load-vn -gcse -instcombine | llvm-dis | grep load
|
||||
; RUN: llvm-as < %s | opt -licm -load-vn -gcse -instcombine | llvm-dis | grep load
|
||||
|
||||
%X = global int 7
|
||||
declare void %foo()
|
||||
@X = global i32 7 ; <i32*> [#uses=2]
|
||||
|
||||
int %test(bool %c) {
|
||||
%A = load int *%X
|
||||
declare void @foo()
|
||||
|
||||
define i32 @test(i1 %c) {
|
||||
%A = load i32* @X ; <i32> [#uses=1]
|
||||
br label %Loop
|
||||
Loop:
|
||||
call void %foo()
|
||||
%B = load int *%X ;; Should not hoist this load!
|
||||
br bool %c, label %Loop, label %Out
|
||||
Out:
|
||||
%C = sub int %A, %B
|
||||
ret int %C
|
||||
Loop: ; preds = %Loop, %0
|
||||
call void @foo( )
|
||||
;; Should not hoist this load!
|
||||
%B = load i32* @X ; <i32> [#uses=1]
|
||||
br i1 %c, label %Loop, label %Out
|
||||
Out: ; preds = %Loop
|
||||
%C = sub i32 %A, %B ; <i32> [#uses=1]
|
||||
ret i32 %C
|
||||
}
|
||||
|
@ -1,27 +1,26 @@
|
||||
; This testcase tests for a problem where LICM hoists
|
||||
; potentially trapping instructions when they are not guaranteed to execute.
|
||||
;
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm | llvm-dis | %prcontext "IfUnEqual" 2 | grep div
|
||||
; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext "IfUnEqual" 2 | grep div
|
||||
|
||||
%X = global int 0
|
||||
declare void %foo()
|
||||
@X = global i32 0 ; <i32*> [#uses=1]
|
||||
|
||||
int %test(bool %c) {
|
||||
%A = load int *%X
|
||||
declare void @foo()
|
||||
|
||||
define i32 @test(i1 %c) {
|
||||
%A = load i32* @X ; <i32> [#uses=2]
|
||||
br label %Loop
|
||||
Loop:
|
||||
call void %foo()
|
||||
br bool %c, label %LoopTail, label %IfUnEqual
|
||||
|
||||
IfUnEqual:
|
||||
%B1 = div int 4, %A ;; Should not hoist this div!
|
||||
Loop: ; preds = %LoopTail, %0
|
||||
call void @foo( )
|
||||
br i1 %c, label %LoopTail, label %IfUnEqual
|
||||
IfUnEqual: ; preds = %Loop
|
||||
%B1 = sdiv i32 4, %A ; <i32> [#uses=1]
|
||||
br label %LoopTail
|
||||
|
||||
LoopTail:
|
||||
%B = phi int [ 0, %Loop ], [ %B1, %IfUnEqual]
|
||||
br bool %c, label %Loop, label %Out
|
||||
|
||||
Out:
|
||||
%C = sub int %A, %B
|
||||
ret int %C
|
||||
LoopTail: ; preds = %IfUnEqual, %Loop
|
||||
%B = phi i32 [ 0, %Loop ], [ %B1, %IfUnEqual ] ; <i32> [#uses=1]
|
||||
br i1 %c, label %Loop, label %Out
|
||||
Out: ; preds = %LoopTail
|
||||
%C = sub i32 %A, %B ; <i32> [#uses=1]
|
||||
ret i32 %C
|
||||
}
|
||||
|
||||
|
@ -1,20 +1,21 @@
|
||||
; This testcase tests to make sure a trapping instruction is hoisted when
|
||||
; it is guaranteed to execute.
|
||||
;
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm | llvm-dis | %prcontext "test" 2 | grep div
|
||||
; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext "test" 2 | grep div
|
||||
|
||||
%X = global int 0
|
||||
declare void %foo(int)
|
||||
@X = global i32 0 ; <i32*> [#uses=1]
|
||||
|
||||
int %test(bool %c) {
|
||||
%A = load int *%X
|
||||
declare void @foo(i32)
|
||||
|
||||
define i32 @test(i1 %c) {
|
||||
%A = load i32* @X ; <i32> [#uses=2]
|
||||
br label %Loop
|
||||
Loop:
|
||||
%B = div int 4, %A ;; Should have hoisted this div!
|
||||
call void %foo(int %B)
|
||||
br bool %c, label %Loop, label %Out
|
||||
|
||||
Out:
|
||||
%C = sub int %A, %B
|
||||
ret int %C
|
||||
Loop: ; preds = %Loop, %0
|
||||
;; Should have hoisted this div!
|
||||
%B = sdiv i32 4, %A ; <i32> [#uses=2]
|
||||
call void @foo( i32 %B )
|
||||
br i1 %c, label %Loop, label %Out
|
||||
Out: ; preds = %Loop
|
||||
%C = sub i32 %A, %B ; <i32> [#uses=1]
|
||||
ret i32 %C
|
||||
}
|
||||
|
@ -1,20 +1,16 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm | lli
|
||||
; RUN: llvm-as < %s | opt -licm | lli
|
||||
|
||||
implementation ; Functions:
|
||||
|
||||
int %main() {
|
||||
define i32 @main() {
|
||||
entry:
|
||||
br label %Loop
|
||||
|
||||
Loop:
|
||||
br bool true, label %LoopCont, label %Out
|
||||
LoopCont:
|
||||
%X = add int 1, 0
|
||||
br bool true, label %Out, label %Loop
|
||||
|
||||
Out:
|
||||
%V = phi int [ 2, %Loop], [ %X, %LoopCont]
|
||||
%V2 = sub int %V, 1
|
||||
ret int %V2
|
||||
Loop: ; preds = %LoopCont, %entry
|
||||
br i1 true, label %LoopCont, label %Out
|
||||
LoopCont: ; preds = %Loop
|
||||
%X = add i32 1, 0 ; <i32> [#uses=1]
|
||||
br i1 true, label %Out, label %Loop
|
||||
Out: ; preds = %LoopCont, %Loop
|
||||
%V = phi i32 [ 2, %Loop ], [ %X, %LoopCont ] ; <i32> [#uses=1]
|
||||
%V2 = sub i32 %V, 1 ; <i32> [#uses=1]
|
||||
ret i32 %V2
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,16 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm | llvm-dis | %prcontext volatile 1 | grep Loop
|
||||
; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext volatile 1 | grep Loop
|
||||
|
||||
%X = global int 7
|
||||
@X = global i32 7 ; <i32*> [#uses=2]
|
||||
|
||||
void %testfunc(int %i) {
|
||||
br label %Loop
|
||||
|
||||
Loop:
|
||||
%x = volatile load int* %X ; Should not promote this to a register
|
||||
%x2 = add int %x, 1
|
||||
store int %x2, int* %X
|
||||
br bool true, label %Out, label %Loop
|
||||
|
||||
Out:
|
||||
ret void
|
||||
define void @testfunc(i32 %i) {
|
||||
br label %Loop
|
||||
Loop: ; preds = %Loop, %0
|
||||
; Should not promote this to a register
|
||||
%x = volatile load i32* @X ; <i32> [#uses=1]
|
||||
%x2 = add i32 %x, 1 ; <i32> [#uses=1]
|
||||
store i32 %x2, i32* @X
|
||||
br i1 true, label %Out, label %Loop
|
||||
Out: ; preds = %Loop
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -1,22 +1,19 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -globalsmodref-aa -licm -disable-output
|
||||
; RUN: llvm-as < %s | opt -globalsmodref-aa -licm -disable-output
|
||||
|
||||
%PL_regcomp_parse = internal global sbyte* null
|
||||
@PL_regcomp_parse = internal global i8* null ; <i8**> [#uses=2]
|
||||
|
||||
implementation
|
||||
|
||||
void %test() {
|
||||
br label %Outer
|
||||
Outer:
|
||||
br label %Inner
|
||||
Inner:
|
||||
%tmp.114.i.i.i = load sbyte** %PL_regcomp_parse
|
||||
%tmp.115.i.i.i = load sbyte* %tmp.114.i.i.i
|
||||
|
||||
store sbyte* null, sbyte** %PL_regcomp_parse
|
||||
|
||||
br bool false, label %Inner, label %Next
|
||||
Next:
|
||||
br bool false, label %Outer, label %Exit
|
||||
Exit:
|
||||
ret void
|
||||
define void @test() {
|
||||
br label %Outer
|
||||
Outer: ; preds = %Next, %0
|
||||
br label %Inner
|
||||
Inner: ; preds = %Inner, %Outer
|
||||
%tmp.114.i.i.i = load i8** @PL_regcomp_parse ; <i8*> [#uses=1]
|
||||
%tmp.115.i.i.i = load i8* %tmp.114.i.i.i ; <i8> [#uses=0]
|
||||
store i8* null, i8** @PL_regcomp_parse
|
||||
br i1 false, label %Inner, label %Next
|
||||
Next: ; preds = %Inner
|
||||
br i1 false, label %Outer, label %Exit
|
||||
Exit: ; preds = %Next
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -1,24 +1,20 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm -disable-output
|
||||
; RUN: llvm-as < %s | opt -licm -disable-output
|
||||
%struct.roadlet = type { i8*, %struct.vehicle*, [8 x %struct.roadlet*], [8 x %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)*] }
|
||||
%struct.vehicle = type { %struct.roadlet*, i8*, i32, i32, %union.._631., i32 }
|
||||
%union.._631. = type { i32 }
|
||||
|
||||
%struct.roadlet = type { sbyte*, %struct.vehicle*, [8 x %struct.roadlet*], [8 x %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, int)*] }
|
||||
%struct.vehicle = type { %struct.roadlet*, sbyte*, int, int, %union.._631., int }
|
||||
%union.._631. = type { int }
|
||||
declare %struct.roadlet* @_Z11return_nullP7roadletP7vehicle9direction(%struct.roadlet*, %struct.vehicle*, i32)
|
||||
|
||||
implementation ; Functions:
|
||||
declare %struct.roadlet* @_Z14lane_switch_okP7roadletP7vehicle9direction(%struct.roadlet*, %struct.vehicle*, i32)
|
||||
|
||||
declare %struct.roadlet* %_Z11return_nullP7roadletP7vehicle9direction(%struct.roadlet*, %struct.vehicle*, int)
|
||||
|
||||
declare %struct.roadlet* %_Z14lane_switch_okP7roadletP7vehicle9direction(%struct.roadlet*, %struct.vehicle*, int)
|
||||
|
||||
void %main() {
|
||||
__main.entry: ; preds = %invoke_cont.1
|
||||
define void @main() {
|
||||
__main.entry:
|
||||
br label %invoke_cont.3
|
||||
|
||||
invoke_cont.3: ; preds = %__main.entry, %invoke_cont.3
|
||||
%tmp.34.i.i502.7 = getelementptr %struct.roadlet* null, int 0, uint 3, int 7 ; <%struct.roadlet* (%struct.roadlet*, %struct.vehicle*, int)**> [#uses=1]
|
||||
store %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, int)* %_Z11return_nullP7roadletP7vehicle9direction, %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, int)** %tmp.34.i.i502.7
|
||||
store %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, int)* %_Z14lane_switch_okP7roadletP7vehicle9direction, %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, int)** null
|
||||
%tmp.4.i.i339 = getelementptr %struct.roadlet* null, int 0, uint 3, int undef ; <%struct.roadlet* (%struct.roadlet*, %struct.vehicle*, int)**> [#uses=1]
|
||||
store %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, int)* %_Z11return_nullP7roadletP7vehicle9direction, %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, int)** %tmp.4.i.i339
|
||||
invoke_cont.3: ; preds = %invoke_cont.3, %__main.entry
|
||||
%tmp.34.i.i502.7 = getelementptr %struct.roadlet* null, i32 0, i32 3, i32 7 ; <%struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)**> [#uses=1]
|
||||
store %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)* @_Z11return_nullP7roadletP7vehicle9direction, %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)** %tmp.34.i.i502.7
|
||||
store %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)* @_Z14lane_switch_okP7roadletP7vehicle9direction, %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)** null
|
||||
%tmp.4.i.i339 = getelementptr %struct.roadlet* null, i32 0, i32 3, i32 undef ; <%struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)**> [#uses=1]
|
||||
store %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)* @_Z11return_nullP7roadletP7vehicle9direction, %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)** %tmp.4.i.i339
|
||||
br label %invoke_cont.3
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm -disable-output
|
||||
; RUN: llvm-as < %s | opt -licm -disable-output
|
||||
|
||||
void %test({int}* %P) {
|
||||
define void @test({ i32 }* %P) {
|
||||
br label %Loop
|
||||
|
||||
Loop:
|
||||
free {int}* %P
|
||||
Loop: ; preds = %Loop, %0
|
||||
free { i32 }* %P
|
||||
br label %Loop
|
||||
}
|
||||
|
||||
|
@ -1,215 +1,148 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm -disable-output
|
||||
; RUN: llvm-as < %s | opt -licm -disable-output
|
||||
; PR908
|
||||
; END.
|
||||
|
||||
%struct.alloc_chain = type { sbyte*, %struct.alloc_chain* }
|
||||
%struct.oggpack_buffer = type { int, int, ubyte*, ubyte*, int }
|
||||
%struct.vorbis_block = type { float**, %struct.oggpack_buffer, int, int, int, int, int, int, long, long, %struct.vorbis_dsp_state*, sbyte*, int, int, int, %struct.alloc_chain*, int, int, int, int, sbyte* }
|
||||
%struct.vorbis_dsp_state = type { int, %struct.vorbis_info*, float**, float**, int, int, int, int, int, int, int, int, int, long, long, long, long, long, long, sbyte* }
|
||||
%struct.vorbis_info = type { int, int, int, int, int, int, int, sbyte* }
|
||||
%struct.alloc_chain = type { i8*, %struct.alloc_chain* }
|
||||
%struct.oggpack_buffer = type { i32, i32, i8*, i8*, i32 }
|
||||
%struct.vorbis_block = type { float**, %struct.oggpack_buffer, i32, i32, i32, i32, i32, i32, i64, i64, %struct.vorbis_dsp_state*, i8*, i32, i32, i32, %struct.alloc_chain*, i32, i32, i32, i32, i8* }
|
||||
%struct.vorbis_dsp_state = type { i32, %struct.vorbis_info*, float**, float**, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i8* }
|
||||
%struct.vorbis_info = type { i32, i32, i32, i32, i32, i32, i32, i8* }
|
||||
|
||||
implementation ; Functions:
|
||||
|
||||
fastcc void %_01forward() {
|
||||
define fastcc void @_01forward() {
|
||||
entry:
|
||||
br bool false, label %bb222.preheader, label %bb241
|
||||
|
||||
br i1 false, label %bb222.preheader, label %bb241
|
||||
cond_true67: ; preds = %cond_true87
|
||||
br label %cond_next80
|
||||
|
||||
cond_next80: ; preds = %cond_true87, %cond_true67
|
||||
br label %bb83
|
||||
|
||||
bb83.preheader: ; preds = %cond_true226
|
||||
br bool false, label %bb83.us.preheader, label %bb83.preheader1
|
||||
|
||||
br i1 false, label %bb83.us.preheader, label %bb83.preheader1
|
||||
bb83.us.preheader: ; preds = %bb83.preheader
|
||||
br label %bb83.us
|
||||
|
||||
bb83.us: ; preds = %cond_next80.us, %bb83.us.preheader
|
||||
br bool false, label %cond_true87.us, label %cond_next92.loopexit2
|
||||
|
||||
br i1 false, label %cond_true87.us, label %cond_next92.loopexit2
|
||||
cond_next80.us: ; preds = %bb59.loopexit.us, %cond_true67.us
|
||||
br label %bb83.us
|
||||
|
||||
cond_true67.us: ; preds = %bb59.loopexit.us
|
||||
br label %cond_next80.us
|
||||
|
||||
cond_next.us: ; preds = %cond_true56.us, %cond_true38.us
|
||||
br bool false, label %cond_true56.us, label %bb59.loopexit.us
|
||||
|
||||
br i1 false, label %cond_true56.us, label %bb59.loopexit.us
|
||||
cond_true38.us: ; preds = %cond_true56.us
|
||||
br label %cond_next.us
|
||||
|
||||
cond_true56.us: ; preds = %cond_true87.us, %cond_next.us
|
||||
br bool false, label %cond_true38.us, label %cond_next.us
|
||||
|
||||
br i1 false, label %cond_true38.us, label %cond_next.us
|
||||
cond_true87.us: ; preds = %bb83.us
|
||||
br label %cond_true56.us
|
||||
|
||||
bb59.loopexit.us: ; preds = %cond_next.us
|
||||
br bool false, label %cond_true67.us, label %cond_next80.us
|
||||
|
||||
br i1 false, label %cond_true67.us, label %cond_next80.us
|
||||
bb83.preheader1: ; preds = %bb83.preheader
|
||||
br label %bb83
|
||||
|
||||
bb83: ; preds = %bb83.preheader1, %cond_next80
|
||||
br bool false, label %cond_next92.loopexit, label %cond_true87
|
||||
|
||||
br i1 false, label %cond_next92.loopexit, label %cond_true87
|
||||
cond_true87: ; preds = %bb83
|
||||
br bool false, label %cond_true67, label %cond_next80
|
||||
|
||||
br i1 false, label %cond_true67, label %cond_next80
|
||||
cond_next92.loopexit: ; preds = %bb83
|
||||
br label %cond_next92
|
||||
|
||||
cond_next92.loopexit2: ; preds = %bb83.us
|
||||
br label %cond_next92
|
||||
|
||||
cond_next92: ; preds = %cond_true226, %cond_next92.loopexit2, %cond_next92.loopexit
|
||||
br bool false, label %cond_true218.loopexit, label %bb222
|
||||
|
||||
br i1 false, label %cond_true218.loopexit, label %bb222
|
||||
cond_true139: ; preds = %cond_true202
|
||||
br bool false, label %cond_next195, label %cond_true155
|
||||
|
||||
br i1 false, label %cond_next195, label %cond_true155
|
||||
cond_true155: ; preds = %cond_true139
|
||||
br bool false, label %cond_true249.i.preheader, label %_encodepart.exit
|
||||
|
||||
br i1 false, label %cond_true249.i.preheader, label %_encodepart.exit
|
||||
cond_true.i: ; preds = %cond_true115.i
|
||||
br bool false, label %bb60.i.preheader, label %cond_next97.i
|
||||
|
||||
br i1 false, label %bb60.i.preheader, label %cond_next97.i
|
||||
bb60.i.preheader: ; preds = %cond_true.i
|
||||
br label %bb60.i
|
||||
|
||||
bb60.i: ; preds = %cond_true63.i, %bb60.i.preheader
|
||||
br bool false, label %cond_true63.i, label %cond_next97.i.loopexit
|
||||
|
||||
br i1 false, label %cond_true63.i, label %cond_next97.i.loopexit
|
||||
cond_true63.i: ; preds = %bb60.i
|
||||
br bool false, label %bb60.i, label %cond_next97.i.loopexit
|
||||
|
||||
br i1 false, label %bb60.i, label %cond_next97.i.loopexit
|
||||
bb86.i.preheader: ; preds = %cond_true115.i
|
||||
br label %bb86.i
|
||||
|
||||
bb86.i: ; preds = %cond_true93.i, %bb86.i.preheader
|
||||
br bool false, label %cond_true93.i, label %cond_next97.i.loopexit3
|
||||
|
||||
br i1 false, label %cond_true93.i, label %cond_next97.i.loopexit3
|
||||
cond_true93.i: ; preds = %bb86.i
|
||||
br bool false, label %cond_next97.i.loopexit3, label %bb86.i
|
||||
|
||||
br i1 false, label %cond_next97.i.loopexit3, label %bb86.i
|
||||
cond_next97.i.loopexit: ; preds = %cond_true63.i, %bb60.i
|
||||
br label %cond_next97.i
|
||||
|
||||
cond_next97.i.loopexit3: ; preds = %cond_true93.i, %bb86.i
|
||||
br label %cond_next97.i
|
||||
|
||||
cond_next97.i: ; preds = %cond_next97.i.loopexit3, %cond_next97.i.loopexit, %cond_true.i
|
||||
br bool false, label %bb118.i.loopexit, label %cond_true115.i
|
||||
|
||||
br i1 false, label %bb118.i.loopexit, label %cond_true115.i
|
||||
cond_true115.i.preheader: ; preds = %cond_true249.i
|
||||
br label %cond_true115.i
|
||||
|
||||
cond_true115.i: ; preds = %cond_true115.i.preheader, %cond_next97.i
|
||||
br bool false, label %cond_true.i, label %bb86.i.preheader
|
||||
|
||||
br i1 false, label %cond_true.i, label %bb86.i.preheader
|
||||
bb118.i.loopexit: ; preds = %cond_next97.i
|
||||
br label %bb118.i
|
||||
|
||||
bb118.i: ; preds = %cond_true249.i, %bb118.i.loopexit
|
||||
br bool false, label %cond_next204.i, label %cond_true128.i
|
||||
|
||||
br i1 false, label %cond_next204.i, label %cond_true128.i
|
||||
cond_true128.i: ; preds = %bb118.i
|
||||
br bool false, label %cond_true199.i.preheader, label %cond_next204.i
|
||||
|
||||
br i1 false, label %cond_true199.i.preheader, label %cond_next204.i
|
||||
cond_true199.i.preheader: ; preds = %cond_true128.i
|
||||
br label %cond_true199.i
|
||||
|
||||
cond_true199.i.us: ; No predecessors!
|
||||
br bool false, label %cond_true167.i.us, label %cond_next187.i.us
|
||||
|
||||
br i1 false, label %cond_true167.i.us, label %cond_next187.i.us
|
||||
cond_next187.i.us: ; preds = %bb170.i.loopexit.us, %bb170.i.us.cond_next187.i.us_crit_edge, %cond_true199.i.us
|
||||
unreachable
|
||||
|
||||
bb170.i.us.cond_next187.i.us_crit_edge: ; preds = %bb170.i.loopexit.us
|
||||
br label %cond_next187.i.us
|
||||
|
||||
cond_true167.i.us: ; preds = %cond_true167.i.us, %cond_true199.i.us
|
||||
br bool false, label %cond_true167.i.us, label %bb170.i.loopexit.us
|
||||
|
||||
br i1 false, label %cond_true167.i.us, label %bb170.i.loopexit.us
|
||||
bb170.i.loopexit.us: ; preds = %cond_true167.i.us
|
||||
br bool false, label %cond_next187.i.us, label %bb170.i.us.cond_next187.i.us_crit_edge
|
||||
|
||||
br i1 false, label %cond_next187.i.us, label %bb170.i.us.cond_next187.i.us_crit_edge
|
||||
cond_true199.i: ; preds = %cond_true199.i, %cond_true199.i.preheader
|
||||
br bool false, label %cond_next204.i.loopexit, label %cond_true199.i
|
||||
|
||||
br i1 false, label %cond_next204.i.loopexit, label %cond_true199.i
|
||||
cond_next204.i.loopexit: ; preds = %cond_true199.i
|
||||
br label %cond_next204.i
|
||||
|
||||
cond_next204.i: ; preds = %cond_next204.i.loopexit, %cond_true128.i, %bb118.i
|
||||
br label %bb233.i
|
||||
|
||||
cond_true230.i: ; No predecessors!
|
||||
%exitcond155 = seteq uint 0, %tmp16.i ; <bool> [#uses=0]
|
||||
%exitcond155 = icmp eq i32 0, %tmp16.i ; <i1> [#uses=0]
|
||||
unreachable
|
||||
|
||||
bb233.i: ; preds = %cond_next204.i
|
||||
br bool false, label %_encodepart.exit.loopexit, label %cond_true249.i
|
||||
|
||||
br i1 false, label %_encodepart.exit.loopexit, label %cond_true249.i
|
||||
cond_true249.i.preheader: ; preds = %cond_true155
|
||||
br label %cond_true249.i
|
||||
|
||||
cond_true249.i: ; preds = %cond_true249.i.preheader, %bb233.i
|
||||
%tmp16.i = cast int 0 to uint ; <uint> [#uses=1]
|
||||
br bool false, label %cond_true115.i.preheader, label %bb118.i
|
||||
|
||||
%tmp16.i = bitcast i32 0 to i32 ; <i32> [#uses=1]
|
||||
br i1 false, label %cond_true115.i.preheader, label %bb118.i
|
||||
_encodepart.exit.loopexit: ; preds = %bb233.i
|
||||
br label %_encodepart.exit
|
||||
|
||||
_encodepart.exit: ; preds = %_encodepart.exit.loopexit, %cond_true155
|
||||
br label %cond_next195
|
||||
|
||||
cond_next195: ; preds = %cond_true202, %_encodepart.exit, %cond_true139
|
||||
br bool false, label %bb205.loopexit, label %cond_true202
|
||||
|
||||
br i1 false, label %bb205.loopexit, label %cond_true202
|
||||
cond_true202.preheader: ; preds = %cond_true218
|
||||
br label %cond_true202
|
||||
|
||||
cond_true202: ; preds = %cond_true202.preheader, %cond_next195
|
||||
br bool false, label %cond_next195, label %cond_true139
|
||||
|
||||
br i1 false, label %cond_next195, label %cond_true139
|
||||
bb205.loopexit: ; preds = %cond_next195
|
||||
br label %bb205
|
||||
|
||||
bb205: ; preds = %cond_true218, %bb205.loopexit
|
||||
br bool false, label %cond_true218, label %bb222.outer105.loopexit
|
||||
|
||||
br i1 false, label %cond_true218, label %bb222.outer105.loopexit
|
||||
cond_true218.loopexit: ; preds = %cond_next92
|
||||
br label %cond_true218
|
||||
|
||||
cond_true218: ; preds = %cond_true218.loopexit, %bb205
|
||||
br bool false, label %cond_true202.preheader, label %bb205
|
||||
|
||||
br i1 false, label %cond_true202.preheader, label %bb205
|
||||
bb222.preheader: ; preds = %entry
|
||||
br label %bb222.outer
|
||||
|
||||
bb222.outer: ; preds = %bb229, %bb222.preheader
|
||||
br label %bb222.outer105
|
||||
|
||||
bb222.outer105.loopexit: ; preds = %bb205
|
||||
br label %bb222.outer105
|
||||
|
||||
bb222.outer105: ; preds = %bb222.outer105.loopexit, %bb222.outer
|
||||
br label %bb222
|
||||
|
||||
bb222: ; preds = %bb222.outer105, %cond_next92
|
||||
br bool false, label %cond_true226, label %bb229
|
||||
|
||||
br i1 false, label %cond_true226, label %bb229
|
||||
cond_true226: ; preds = %bb222
|
||||
br bool false, label %bb83.preheader, label %cond_next92
|
||||
|
||||
br i1 false, label %bb83.preheader, label %cond_next92
|
||||
bb229: ; preds = %bb222
|
||||
br bool false, label %bb222.outer, label %bb241.loopexit
|
||||
|
||||
br i1 false, label %bb222.outer, label %bb241.loopexit
|
||||
bb241.loopexit: ; preds = %bb229
|
||||
br label %bb241
|
||||
|
||||
bb241: ; preds = %bb241.loopexit, %entry
|
||||
ret void
|
||||
}
|
||||
|
@ -1,17 +1,15 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm | llvm-dis
|
||||
|
||||
void "testfunc"(int %i) {
|
||||
; RUN: llvm-as < %s | opt -licm | llvm-dis
|
||||
|
||||
define void @testfunc(i32 %i) {
|
||||
; <label>:0
|
||||
br label %Loop
|
||||
|
||||
Loop:
|
||||
%j = phi uint [0, %0], [%Next, %Loop]
|
||||
%i = cast int %i to uint
|
||||
%i2 = mul uint %i, 17
|
||||
%Next = add uint %j, %i2
|
||||
%cond = seteq uint %Next, 0
|
||||
br bool %cond, label %Out, label %Loop
|
||||
|
||||
Out:
|
||||
Loop: ; preds = %Loop, %0
|
||||
%j = phi i32 [ 0, %0 ], [ %Next, %Loop ] ; <i32> [#uses=1]
|
||||
%i2 = mul i32 %i, 17 ; <i32> [#uses=1]
|
||||
%Next = add i32 %j, %i2 ; <i32> [#uses=2]
|
||||
%cond = icmp eq i32 %Next, 0 ; <i1> [#uses=1]
|
||||
br i1 %cond, label %Out, label %Loop
|
||||
Out: ; preds = %Loop
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -1,21 +1,20 @@
|
||||
; Test that LICM works when there is not a loop-preheader
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm | llvm-dis
|
||||
; RUN: llvm-as < %s | opt -licm | llvm-dis
|
||||
|
||||
void "testfunc"(int %i.s, bool %ifcond) {
|
||||
br bool %ifcond, label %Then, label %Else
|
||||
Then:
|
||||
define void @testfunc(i32 %i.s, i1 %ifcond) {
|
||||
br i1 %ifcond, label %Then, label %Else
|
||||
Then: ; preds = %0
|
||||
br label %Loop
|
||||
Else:
|
||||
Else: ; preds = %0
|
||||
br label %Loop
|
||||
|
||||
Loop:
|
||||
%j = phi uint [0, %Then], [12, %Else], [%Next, %Loop]
|
||||
%i = cast int %i.s to uint
|
||||
%i2 = mul uint %i, 17
|
||||
%Next = add uint %j, %i2
|
||||
%cond = seteq uint %Next, 0
|
||||
br bool %cond, label %Out, label %Loop
|
||||
|
||||
Out:
|
||||
Loop: ; preds = %Loop, %Else, %Then
|
||||
%j = phi i32 [ 0, %Then ], [ 12, %Else ], [ %Next, %Loop ] ; <i32> [#uses=1]
|
||||
%i = bitcast i32 %i.s to i32 ; <i32> [#uses=1]
|
||||
%i2 = mul i32 %i, 17 ; <i32> [#uses=1]
|
||||
%Next = add i32 %j, %i2 ; <i32> [#uses=2]
|
||||
%cond = icmp eq i32 %Next, 0 ; <i1> [#uses=1]
|
||||
br i1 %cond, label %Out, label %Loop
|
||||
Out: ; preds = %Loop
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -1,19 +1,16 @@
|
||||
; This testcase checks to make sure the sinker does not cause problems with
|
||||
; critical edges.
|
||||
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm | llvm-dis | %prcontext add 1 | grep Exit
|
||||
; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext add 1 | grep Exit
|
||||
|
||||
implementation ; Functions:
|
||||
|
||||
void %test() {
|
||||
define void @test() {
|
||||
Entry:
|
||||
br bool false, label %Loop, label %Exit
|
||||
|
||||
Loop:
|
||||
%X = add int 0, 1
|
||||
br bool false, label %Loop, label %Exit
|
||||
|
||||
Exit:
|
||||
%Y = phi int [ 0, %Entry ], [ %X, %Loop ]
|
||||
br i1 false, label %Loop, label %Exit
|
||||
Loop: ; preds = %Loop, %Entry
|
||||
%X = add i32 0, 1 ; <i32> [#uses=1]
|
||||
br i1 false, label %Loop, label %Exit
|
||||
Exit: ; preds = %Loop, %Entry
|
||||
%Y = phi i32 [ 0, %Entry ], [ %X, %Loop ] ; <i32> [#uses=0]
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -2,18 +2,19 @@
|
||||
; the instruction to the exit blocks instead of executing it on every
|
||||
; iteration of the loop.
|
||||
;
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm | llvm-dis | %prcontext mul 1 | grep Out:
|
||||
; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext mul 1 | grep Out:
|
||||
|
||||
int %test(int %N) {
|
||||
define i32 @test(i32 %N) {
|
||||
Entry:
|
||||
br label %Loop
|
||||
Loop:
|
||||
%N_addr.0.pn = phi int [ %dec, %Loop ], [ %N, %Entry ]
|
||||
%tmp.6 = mul int %N, %N_addr.0.pn
|
||||
%tmp.7 = sub int %tmp.6, %N
|
||||
%dec = add int %N_addr.0.pn, -1
|
||||
%tmp.1 = setne int %N_addr.0.pn, 1
|
||||
br bool %tmp.1, label %Loop, label %Out
|
||||
Out:
|
||||
ret int %tmp.7
|
||||
Loop: ; preds = %Loop, %Entry
|
||||
%N_addr.0.pn = phi i32 [ %dec, %Loop ], [ %N, %Entry ] ; <i32> [#uses=3]
|
||||
%tmp.6 = mul i32 %N, %N_addr.0.pn ; <i32> [#uses=1]
|
||||
%tmp.7 = sub i32 %tmp.6, %N ; <i32> [#uses=1]
|
||||
%dec = add i32 %N_addr.0.pn, -1 ; <i32> [#uses=1]
|
||||
%tmp.1 = icmp ne i32 %N_addr.0.pn, 1 ; <i1> [#uses=1]
|
||||
br i1 %tmp.1, label %Loop, label %Out
|
||||
Out: ; preds = %Loop
|
||||
ret i32 %tmp.7
|
||||
}
|
||||
|
||||
|
@ -2,19 +2,20 @@
|
||||
; result of the load is only used outside of the loop, sink the load instead of
|
||||
; hoisting it!
|
||||
;
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm | llvm-dis | %prcontext load 1 | grep Out:
|
||||
; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext load 1 | grep Out:
|
||||
|
||||
%X = global int 5
|
||||
@X = global i32 5 ; <i32*> [#uses=1]
|
||||
|
||||
int %test(int %N) {
|
||||
define i32 @test(i32 %N) {
|
||||
Entry:
|
||||
br label %Loop
|
||||
Loop:
|
||||
%N_addr.0.pn = phi int [ %dec, %Loop ], [ %N, %Entry ]
|
||||
%tmp.6 = load int* %X
|
||||
%dec = add int %N_addr.0.pn, -1
|
||||
%tmp.1 = setne int %N_addr.0.pn, 1
|
||||
br bool %tmp.1, label %Loop, label %Out
|
||||
Out:
|
||||
ret int %tmp.6
|
||||
Loop: ; preds = %Loop, %Entry
|
||||
%N_addr.0.pn = phi i32 [ %dec, %Loop ], [ %N, %Entry ] ; <i32> [#uses=2]
|
||||
%tmp.6 = load i32* @X ; <i32> [#uses=1]
|
||||
%dec = add i32 %N_addr.0.pn, -1 ; <i32> [#uses=1]
|
||||
%tmp.1 = icmp ne i32 %N_addr.0.pn, 1 ; <i1> [#uses=1]
|
||||
br i1 %tmp.1, label %Loop, label %Out
|
||||
Out: ; preds = %Loop
|
||||
ret i32 %tmp.6
|
||||
}
|
||||
|
||||
|
@ -3,18 +3,19 @@
|
||||
; instructions from the loop. Instead they got hoisted, which is better than
|
||||
; leaving them in the loop, but increases register pressure pointlessly.
|
||||
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm | llvm-dis | \
|
||||
; RUN: llvm-as < %s | opt -licm | llvm-dis | \
|
||||
; RUN: %prcontext getelementptr 1 | grep Out:
|
||||
|
||||
%Ty = type { int, int }
|
||||
%X = external global %Ty
|
||||
%Ty = type { i32, i32 }
|
||||
@X = external global %Ty ; <%Ty*> [#uses=1]
|
||||
|
||||
int %test() {
|
||||
br label %Loop
|
||||
Loop:
|
||||
%dead = getelementptr %Ty* %X, long 0, uint 0
|
||||
%sunk2 = load int* %dead
|
||||
br bool false, label %Loop, label %Out
|
||||
Out:
|
||||
ret int %sunk2
|
||||
define i32 @test() {
|
||||
br label %Loop
|
||||
Loop: ; preds = %Loop, %0
|
||||
%dead = getelementptr %Ty* @X, i64 0, i32 0 ; <i32*> [#uses=1]
|
||||
%sunk2 = load i32* %dead ; <i32> [#uses=1]
|
||||
br i1 false, label %Loop, label %Out
|
||||
Out: ; preds = %Loop
|
||||
ret i32 %sunk2
|
||||
}
|
||||
|
||||
|
@ -1,23 +1,24 @@
|
||||
; This testcase ensures that we can sink instructions from loops with
|
||||
; multiple exits.
|
||||
;
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm | llvm-dis | \
|
||||
; RUN: llvm-as < %s | opt -licm | llvm-dis | \
|
||||
; RUN: %prcontext mul 1 | grep {Out\[12\]:}
|
||||
|
||||
int %test(int %N, bool %C) {
|
||||
define i32 @test(i32 %N, i1 %C) {
|
||||
Entry:
|
||||
br label %Loop
|
||||
Loop:
|
||||
%N_addr.0.pn = phi int [ %dec, %ContLoop ], [ %N, %Entry ]
|
||||
%tmp.6 = mul int %N, %N_addr.0.pn
|
||||
%tmp.7 = sub int %tmp.6, %N
|
||||
%dec = add int %N_addr.0.pn, -1
|
||||
br bool %C, label %ContLoop, label %Out1
|
||||
ContLoop:
|
||||
%tmp.1 = setne int %N_addr.0.pn, 1
|
||||
br bool %tmp.1, label %Loop, label %Out2
|
||||
Out1:
|
||||
ret int %tmp.7
|
||||
Out2:
|
||||
ret int %tmp.7
|
||||
Loop: ; preds = %ContLoop, %Entry
|
||||
%N_addr.0.pn = phi i32 [ %dec, %ContLoop ], [ %N, %Entry ] ; <i32> [#uses=3]
|
||||
%tmp.6 = mul i32 %N, %N_addr.0.pn ; <i32> [#uses=1]
|
||||
%tmp.7 = sub i32 %tmp.6, %N ; <i32> [#uses=2]
|
||||
%dec = add i32 %N_addr.0.pn, -1 ; <i32> [#uses=1]
|
||||
br i1 %C, label %ContLoop, label %Out1
|
||||
ContLoop: ; preds = %Loop
|
||||
%tmp.1 = icmp ne i32 %N_addr.0.pn, 1 ; <i1> [#uses=1]
|
||||
br i1 %tmp.1, label %Loop, label %Out2
|
||||
Out1: ; preds = %Loop
|
||||
ret i32 %tmp.7
|
||||
Out2: ; preds = %ContLoop
|
||||
ret i32 %tmp.7
|
||||
}
|
||||
|
||||
|
@ -2,25 +2,22 @@
|
||||
; some exits out of the loop, and that we can do so without breaking dominator
|
||||
; info.
|
||||
;
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm | llvm-dis | \
|
||||
; RUN: llvm-as < %s | opt -licm | llvm-dis | \
|
||||
; RUN: %prcontext add 1 | grep exit2:
|
||||
|
||||
implementation ; Functions:
|
||||
|
||||
int %test(bool %C1, bool %C2, int *%P, int* %Q) {
|
||||
define i32 @test(i1 %C1, i1 %C2, i32* %P, i32* %Q) {
|
||||
Entry:
|
||||
br label %Loop
|
||||
|
||||
Loop:
|
||||
br bool %C1, label %Cont, label %exit1
|
||||
Cont:
|
||||
%X = load int* %P
|
||||
store int %X, int* %Q
|
||||
%V = add int %X, 1
|
||||
br bool %C2, label %Loop, label %exit2
|
||||
|
||||
exit1:
|
||||
ret int 0
|
||||
exit2:
|
||||
ret int %V
|
||||
Loop: ; preds = %Cont, %Entry
|
||||
br i1 %C1, label %Cont, label %exit1
|
||||
Cont: ; preds = %Loop
|
||||
%X = load i32* %P ; <i32> [#uses=2]
|
||||
store i32 %X, i32* %Q
|
||||
%V = add i32 %X, 1 ; <i32> [#uses=1]
|
||||
br i1 %C2, label %Loop, label %exit2
|
||||
exit1: ; preds = %Loop
|
||||
ret i32 0
|
||||
exit2: ; preds = %Cont
|
||||
ret i32 %V
|
||||
}
|
||||
|
||||
|
@ -1,28 +1,21 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm | llvm-dis | %prcontext add 1 | grep preheader.loopexit:
|
||||
; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext add 1 | grep preheader.loopexit:
|
||||
|
||||
implementation
|
||||
|
||||
void %test() {
|
||||
define void @test() {
|
||||
loopentry.2.i:
|
||||
br bool false, label %no_exit.1.i.preheader, label %loopentry.3.i.preheader
|
||||
|
||||
no_exit.1.i.preheader:
|
||||
br i1 false, label %no_exit.1.i.preheader, label %loopentry.3.i.preheader
|
||||
no_exit.1.i.preheader: ; preds = %loopentry.2.i
|
||||
br label %no_exit.1.i
|
||||
|
||||
no_exit.1.i:
|
||||
br bool false, label %return.i, label %endif.8.i
|
||||
|
||||
endif.8.i:
|
||||
%inc.1.i = add int 0, 1
|
||||
br bool false, label %no_exit.1.i, label %loopentry.3.i.preheader.loopexit
|
||||
|
||||
loopentry.3.i.preheader.loopexit:
|
||||
no_exit.1.i: ; preds = %endif.8.i, %no_exit.1.i.preheader
|
||||
br i1 false, label %return.i, label %endif.8.i
|
||||
endif.8.i: ; preds = %no_exit.1.i
|
||||
%inc.1.i = add i32 0, 1 ; <i32> [#uses=1]
|
||||
br i1 false, label %no_exit.1.i, label %loopentry.3.i.preheader.loopexit
|
||||
loopentry.3.i.preheader.loopexit: ; preds = %endif.8.i
|
||||
br label %loopentry.3.i.preheader
|
||||
|
||||
loopentry.3.i.preheader:
|
||||
%arg_num.0.i.ph13000 = phi int [ 0, %loopentry.2.i ], [ %inc.1.i, %loopentry.3.i.preheader.loopexit ]
|
||||
loopentry.3.i.preheader: ; preds = %loopentry.3.i.preheader.loopexit, %loopentry.2.i
|
||||
%arg_num.0.i.ph13000 = phi i32 [ 0, %loopentry.2.i ], [ %inc.1.i, %loopentry.3.i.preheader.loopexit ] ; <i32> [#uses=0]
|
||||
ret void
|
||||
|
||||
return.i:
|
||||
return.i: ; preds = %no_exit.1.i
|
||||
ret void
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,18 @@
|
||||
; Potentially trapping instructions may be sunk as long as they are guaranteed
|
||||
; to be executed.
|
||||
;
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm | llvm-dis | %prcontext div 1 | grep Out:
|
||||
; RUN: llvm-as < %s | opt -licm | llvm-dis | %prcontext div 1 | grep Out:
|
||||
|
||||
int %test(int %N) {
|
||||
define i32 @test(i32 %N) {
|
||||
Entry:
|
||||
br label %Loop
|
||||
Loop:
|
||||
%N_addr.0.pn = phi int [ %dec, %Loop ], [ %N, %Entry ]
|
||||
%tmp.6 = div int %N, %N_addr.0.pn
|
||||
%dec = add int %N_addr.0.pn, -1
|
||||
%tmp.1 = setne int %N_addr.0.pn, 0
|
||||
br bool %tmp.1, label %Loop, label %Out
|
||||
Out:
|
||||
ret int %tmp.6
|
||||
Loop: ; preds = %Loop, %Entry
|
||||
%N_addr.0.pn = phi i32 [ %dec, %Loop ], [ %N, %Entry ] ; <i32> [#uses=3]
|
||||
%tmp.6 = sdiv i32 %N, %N_addr.0.pn ; <i32> [#uses=1]
|
||||
%dec = add i32 %N_addr.0.pn, -1 ; <i32> [#uses=1]
|
||||
%tmp.1 = icmp ne i32 %N_addr.0.pn, 0 ; <i1> [#uses=1]
|
||||
br i1 %tmp.1, label %Loop, label %Out
|
||||
Out: ; preds = %Loop
|
||||
ret i32 %tmp.6
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user