mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-08 21:32:39 +00:00
Fix PR3353, infinitely jump threading an infinite loop make from switches.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62529 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1f54f58e64
commit
2c7ed11d93
@ -419,6 +419,11 @@ bool JumpThreading::ProcessBranchOnDuplicateCond(BasicBlock *PredBB,
|
||||
/// switches out of repeated 'if' conditions.
|
||||
bool JumpThreading::ProcessSwitchOnDuplicateCond(BasicBlock *PredBB,
|
||||
BasicBlock *DestBB) {
|
||||
// Can't thread edge to self.
|
||||
if (PredBB == DestBB)
|
||||
return false;
|
||||
|
||||
|
||||
SwitchInst *PredSI = cast<SwitchInst>(PredBB->getTerminator());
|
||||
SwitchInst *DestSI = cast<SwitchInst>(DestBB->getTerminator());
|
||||
|
||||
|
21
test/Transforms/JumpThreading/2009-01-19-InfSwitchLoop.ll
Normal file
21
test/Transforms/JumpThreading/2009-01-19-InfSwitchLoop.ll
Normal file
@ -0,0 +1,21 @@
|
||||
; RUN: llvm-as < %s | opt -jump-threading | llvm-dis
|
||||
; PR3353
|
||||
|
||||
define i32 @test(i8 %X) {
|
||||
entry:
|
||||
%Y = add i8 %X, 1
|
||||
%Z = add i8 %Y, 1
|
||||
br label %bb33.i
|
||||
|
||||
bb33.i: ; preds = %bb33.i, %bb32.i
|
||||
switch i8 %Y, label %bb32.i [
|
||||
i8 39, label %bb35.split.i
|
||||
i8 13, label %bb33.i
|
||||
]
|
||||
|
||||
bb35.split.i:
|
||||
ret i32 5
|
||||
bb32.i:
|
||||
ret i32 1
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user