mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-26 12:46:00 +00:00
[LoopUnrolling] Fix a bug introduced in r259869 (PR26688).
The issue was that we only required LCSSA rebuilding if the immediate parent-loop had values used outside of it. The fix is to enaable the same logic for all outer loops, not only immediate parent. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261575 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cd25a02e5e
commit
0070b261d7
@ -142,9 +142,13 @@ static bool needToInsertPhisForLCSSA(Loop *L, std::vector<BasicBlock *> Blocks,
|
||||
continue;
|
||||
for (Instruction &I : *BB) {
|
||||
for (Use &U : I.operands()) {
|
||||
if (auto Def = dyn_cast<Instruction>(U))
|
||||
if (LI->getLoopFor(Def->getParent()) == L)
|
||||
if (auto Def = dyn_cast<Instruction>(U)) {
|
||||
Loop *DefLoop = LI->getLoopFor(Def->getParent());
|
||||
if (!DefLoop)
|
||||
continue;
|
||||
if (DefLoop->contains(L))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -117,3 +117,37 @@ Exit:
|
||||
%a_lcssa2 = phi i8* [ %a_lcssa1, %L2_exit ]
|
||||
ret void
|
||||
}
|
||||
|
||||
; PR26688
|
||||
; CHECK-LABEL: @foo4
|
||||
define i8 @foo4() {
|
||||
entry:
|
||||
br label %L1_header
|
||||
|
||||
L1_header:
|
||||
%x = icmp eq i32 1, 0
|
||||
br label %L2_header
|
||||
|
||||
L2_header:
|
||||
br label %L3_header
|
||||
|
||||
L3_header:
|
||||
br i1 true, label %L2_header, label %L3_exiting
|
||||
|
||||
L3_exiting:
|
||||
br i1 true, label %L3_body, label %L1_latch
|
||||
|
||||
; CHECK: L3_body:
|
||||
; CHECK-NEXT: %x.lcssa = phi i1
|
||||
L3_body:
|
||||
br i1 %x, label %L3_latch, label %L3_latch
|
||||
|
||||
L3_latch:
|
||||
br i1 false, label %L3_header, label %exit
|
||||
|
||||
L1_latch:
|
||||
br label %L1_header
|
||||
|
||||
exit:
|
||||
ret i8 0
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user