mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-23 02:29:18 +00:00
LoopSimplify shouldn't split loop backedges that use indirectbr. PR7867.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111061 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e2c6d131d1
commit
c2f40066bb
@ -622,6 +622,11 @@ LoopSimplify::InsertUniqueBackedgeBlock(Loop *L, BasicBlock *Preheader) {
|
||||
std::vector<BasicBlock*> BackedgeBlocks;
|
||||
for (pred_iterator I = pred_begin(Header), E = pred_end(Header); I != E; ++I){
|
||||
BasicBlock *P = *I;
|
||||
|
||||
// Indirectbr edges cannot be split, so we must fail if we find one.
|
||||
if (isa<IndirectBrInst>(P->getTerminator()))
|
||||
return 0;
|
||||
|
||||
if (P != Preheader) BackedgeBlocks.push_back(P);
|
||||
}
|
||||
|
||||
|
35
test/Transforms/LoopSimplify/indirectbr-backedge.ll
Normal file
35
test/Transforms/LoopSimplify/indirectbr-backedge.ll
Normal file
@ -0,0 +1,35 @@
|
||||
; RUN: opt -loopsimplify -S < %s | FileCheck %s
|
||||
|
||||
; LoopSimplify shouldn't split loop backedges that use indirectbr.
|
||||
|
||||
; CHECK: bb1: ; preds = %bb5, %bb
|
||||
; CHECK-NEXT: indirectbr
|
||||
|
||||
; CHECK: bb5: ; preds = %bb1
|
||||
; CHECK-NEXT: br label %bb1{{$}}
|
||||
|
||||
define void @foo(i8* %p) nounwind {
|
||||
bb:
|
||||
br label %bb1
|
||||
|
||||
bb1: ; preds = %bb5, %bb1, %bb
|
||||
indirectbr i8* %p, [label %bb6, label %bb7, label %bb1, label %bb2, label %bb3, label %bb5, label %bb4]
|
||||
|
||||
bb2: ; preds = %bb1
|
||||
ret void
|
||||
|
||||
bb3: ; preds = %bb1
|
||||
ret void
|
||||
|
||||
bb4: ; preds = %bb1
|
||||
ret void
|
||||
|
||||
bb5: ; preds = %bb1
|
||||
br label %bb1
|
||||
|
||||
bb6: ; preds = %bb1
|
||||
ret void
|
||||
|
||||
bb7: ; preds = %bb1
|
||||
ret void
|
||||
}
|
Loading…
Reference in New Issue
Block a user