mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-20 12:05:48 -04:00
Revert "Revert "[LoopSimplify] Fix updating LCSSA after separating nested loops.""
This reverts commit r277901. Reaaply the commit as it looks like it has nothing to do with the bots failures. llvm-svn: 277946
This commit is contained in:
parent
4679644c53
commit
442b82f0eb
@ -376,6 +376,21 @@ static Loop *separateNestedLoop(Loop *L, BasicBlock *Preheader,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// We also need to check exit blocks of the outer loop - it might be using
|
||||||
|
// values from what now became an inner loop.
|
||||||
|
SmallVector<BasicBlock*, 8> ExitBlocks;
|
||||||
|
NewOuter->getExitBlocks(ExitBlocks);
|
||||||
|
for (BasicBlock *ExitBB: ExitBlocks) {
|
||||||
|
for (Instruction &I : *ExitBB) {
|
||||||
|
for (Value *Op : I.operands()) {
|
||||||
|
Instruction *OpI = dyn_cast<Instruction>(Op);
|
||||||
|
if (!OpI || !L->contains(OpI))
|
||||||
|
continue;
|
||||||
|
WorklistSet.insert(OpI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SmallVector<Instruction *, 8> Worklist(WorklistSet.begin(),
|
SmallVector<Instruction *, 8> Worklist(WorklistSet.begin(),
|
||||||
WorklistSet.end());
|
WorklistSet.end());
|
||||||
formLCSSAForInstructions(Worklist, *DT, *LI);
|
formLCSSAForInstructions(Worklist, *DT, *LI);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
; RUN: opt < %s -lcssa -loop-unroll -S | FileCheck %s
|
; RUN: opt < %s -lcssa -loop-unroll -S | FileCheck %s
|
||||||
target triple = "x86_64-unknown-linux-gnu"
|
target triple = "x86_64-unknown-linux-gnu"
|
||||||
|
|
||||||
; PR28272
|
; PR28272, PR28825
|
||||||
; When LoopSimplify separates nested loops, it might break LCSSA form: values
|
; When LoopSimplify separates nested loops, it might break LCSSA form: values
|
||||||
; from the original loop might be used in the outer loop. This test invokes
|
; from the original loop might be used in the outer loop. This test invokes
|
||||||
; loop-unroll, which calls loop-simplify before itself. If LCSSA is broken
|
; loop-unroll, which calls loop-simplify before itself. If LCSSA is broken
|
||||||
@ -74,3 +74,35 @@ loop2.if.false:
|
|||||||
bb:
|
bb:
|
||||||
br label %loop2
|
br label %loop2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
; When LoopSimplify separates nested loops, it might break LCSSA form: values
|
||||||
|
; from the original loop might be used in exit blocks of the outer loop.
|
||||||
|
; CHECK-LABEL: @foo3
|
||||||
|
define void @foo3() {
|
||||||
|
entry:
|
||||||
|
br label %bb1
|
||||||
|
|
||||||
|
bb1:
|
||||||
|
br i1 undef, label %bb2, label %bb1
|
||||||
|
|
||||||
|
bb2:
|
||||||
|
%a = phi i32 [ undef, %bb1 ], [ %a, %bb3 ], [ undef, %bb5 ]
|
||||||
|
br i1 undef, label %bb3, label %bb1
|
||||||
|
|
||||||
|
bb3:
|
||||||
|
%b = load i32*, i32** undef
|
||||||
|
br i1 undef, label %bb2, label %bb4
|
||||||
|
|
||||||
|
bb4:
|
||||||
|
br i1 undef, label %bb5, label %bb6
|
||||||
|
|
||||||
|
bb5:
|
||||||
|
br i1 undef, label %bb2, label %bb4
|
||||||
|
|
||||||
|
bb6:
|
||||||
|
br i1 undef, label %bb_end, label %bb1
|
||||||
|
|
||||||
|
bb_end:
|
||||||
|
%x = getelementptr i32, i32* %b
|
||||||
|
br label %bb_end
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user