2003-12-19 06:54:37 +00:00
|
|
|
; The loop sinker was running from the bottom of the loop to the top, causing
|
|
|
|
; it to miss opportunities to sink instructions that depended on sinking other
|
|
|
|
; instructions from the loop. Instead they got hoisted, which is better than
|
|
|
|
; leaving them in the loop, but increases register pressure pointlessly.
|
|
|
|
|
2008-03-19 03:47:13 +00:00
|
|
|
; RUN: llvm-as < %s | opt -licm | llvm-dis | \
|
2007-04-15 08:30:33 +00:00
|
|
|
; RUN: %prcontext getelementptr 1 | grep Out:
|
2003-12-19 06:54:37 +00:00
|
|
|
|
2008-03-19 03:47:13 +00:00
|
|
|
%Ty = type { i32, i32 }
|
|
|
|
@X = external global %Ty ; <%Ty*> [#uses=1]
|
2003-12-19 06:54:37 +00:00
|
|
|
|
2008-03-19 03:47:13 +00:00
|
|
|
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
|
2003-12-19 06:54:37 +00:00
|
|
|
}
|
2008-03-19 03:47:13 +00:00
|
|
|
|