<div dir="ltr"><div dir="ltr">Thanks for the quick reply :)<div>It's still an issue for release builds, it just fails elsewhere:</div><div>...</div><div><div> #3 0x000055ede0c1c217 llvm::LoopInfo::erase(llvm::Loop*) (bin/clang+0x3d38217)</div><div> #4 0x000055ede085c334 ConstantTerminatorFoldingImpl::deleteDeadLoopBlocks() (bin/clang+0x3978334)</div></div><div>My guess is that since the assertion in llvm::DeleteDeadBlock does run (thus aborting the compiler), something's in an inconsistent state that causes llvm::LoopInfo::erase() to die on the next loop iteration.</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Dec 27, 2018 at 10:12 PM Maxim Kazantsev <<a href="mailto:max.kazantsev@azul.com">max.kazantsev@azul.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="RU">
<div class="gmail-m_-662843273854979658WordSection1">
<p class="MsoNormal"><span lang="EN-US">Thanks Jordan!<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">I was able to construct an IR test that reproduces this problem. It seems that the utility function I am using is unable to deal with multi-block subloops. I shouldn’t really be a problem
in production, but assertion will fail. I will temporarily disable the transform and prepare a fix.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">--Max<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Jordan Rupprecht <<a href="mailto:rupprecht@google.com" target="_blank">rupprecht@google.com</a>>
<br>
<b>Sent:</b> Friday, December 28, 2018 7:31 AM<br>
<b>To:</b> Maxim Kazantsev <<a href="mailto:max.kazantsev@azul.com" target="_blank">max.kazantsev@azul.com</a>><br>
<b>Cc:</b> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<b>Subject:</b> Re: [llvm] r350045 - Return "[LoopSimplifyCFG] Delete dead in-loop blocks"<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<div>
<div>
<p class="MsoNormal">Looks like this causes a crash w/ new pass manager + profile generation. When using clang (w/ asserts enabled) to compile itself:<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">$ bin/clang -c ~/src/llvm/lib/CodeGen/RegAllocPBQP.cpp -I$HOME/src/llvm/include/ -Iinclude -O1 -fprofile-generate -fexperimental-new-pass-manager<u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">clang-8: ~/src/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp:54: void llvm::DeleteDeadBlock(llvm::BasicBlock *, llvm::DomTreeUpdater *): Assertion `(pred_begin(BB) == pred_end(BB)<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">|| BB->getSinglePredecessor() == BB) && "Block is not dead!"' failed.<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Stack:<u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal">1. <eof> parser at end of file<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">2. Optimizer<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">...<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> #9 0x00007f9af5ad4719 llvm::DeleteDeadBlock(llvm::BasicBlock*, llvm::DomTreeUpdater*) ~/src/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp:55:25<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">#10 0x00007f9af6709f7d ConstantTerminatorFoldingImpl::deleteDeadLoopBlocks() ~/src/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp:400:7<u></u><u></u></p>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Sun, Dec 23, 2018 at 10:09 PM Max Kazantsev via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal">Author: mkazantsev<br>
Date: Sun Dec 23 22:06:17 2018<br>
New Revision: 350045<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=350045&view=rev" target="_blank">
http://llvm.org/viewvc/llvm-project?rev=350045&view=rev</a><br>
Log:<br>
Return "[LoopSimplifyCFG] Delete dead in-loop blocks"<br>
<br>
The underlying bug that caused the revert should be fixed by rL348567.<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D54023" target="_blank">
https://reviews.llvm.org/D54023</a><br>
<br>
Modified:<br>
llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp<br>
llvm/trunk/test/Transforms/LoopSimplifyCFG/constant-fold-branch.ll<br>
<br>
Modified: llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp?rev=350045&r1=350044&r2=350045&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp?rev=350045&r1=350044&r2=350045&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp Sun Dec 23 22:06:17 2018<br>
@@ -46,6 +46,8 @@ static cl::opt<bool> EnableTermFolding("<br>
<br>
STATISTIC(NumTerminatorsFolded,<br>
"Number of terminators folded to unconditional branches");<br>
+STATISTIC(NumLoopBlocksDeleted,<br>
+ "Number of loop blocks deleted");<br>
<br>
/// If \p BB is a switch or a conditional branch, but only one of its successors<br>
/// can be reached from this block in runtime, return this successor. Otherwise,<br>
@@ -269,6 +271,27 @@ private:<br>
"All blocks that stay in loop should be live!");<br>
}<br>
<br>
+ /// Delete loop blocks that have become unreachable after folding. Make all<br>
+ /// relevant updates to DT and LI.<br>
+ void deleteDeadLoopBlocks() {<br>
+ DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Eager);<br>
+ if (MSSAU)<br>
+ MSSAU->removeBlocks(DeadLoopBlocks);<br>
+ for (auto *BB : DeadLoopBlocks) {<br>
+ assert(BB != L.getHeader() &&<br>
+ "Header of the current loop cannot be dead!");<br>
+ LLVM_DEBUG(dbgs() << "Deleting dead loop block " << BB->getName()<br>
+ << "\n");<br>
+ if (LI.isLoopHeader(BB)) {<br>
+ assert(LI.getLoopFor(BB) != &L && "Attempt to remove current loop!");<br>
+ LI.erase(LI.getLoopFor(BB));<br>
+ }<br>
+ LI.removeBlock(BB);<br>
+ DeleteDeadBlock(BB, &DTU);<br>
+ ++NumLoopBlocksDeleted;<br>
+ }<br>
+ }<br>
+<br>
/// Constant-fold terminators of blocks acculumated in FoldCandidates into the<br>
/// unconditional branches.<br>
void foldTerminators() {<br>
@@ -358,15 +381,6 @@ public:<br>
return false;<br>
}<br>
<br>
- // TODO: Support deletion of dead loop blocks.<br>
- if (!DeadLoopBlocks.empty()) {<br>
- LLVM_DEBUG(dbgs() << "Give up constant terminator folding in loop "<br>
- << L.getHeader()->getName()<br>
- << ": we don't currently"<br>
- " support deletion of dead in-loop blocks.\n");<br>
- return false;<br>
- }<br>
-<br>
// TODO: Support dead loop exits.<br>
if (!DeadExitBlocks.empty()) {<br>
LLVM_DEBUG(dbgs() << "Give up constant terminator folding in loop "<br>
@@ -377,7 +391,8 @@ public:<br>
<br>
// TODO: Support blocks that are not dead, but also not in loop after the<br>
// folding.<br>
- if (BlocksInLoopAfterFolding.size() != L.getNumBlocks()) {<br>
+ if (BlocksInLoopAfterFolding.size() + DeadLoopBlocks.size() !=<br>
+ L.getNumBlocks()) {<br>
LLVM_DEBUG(<br>
dbgs() << "Give up constant terminator folding in loop "<br>
<< L.getHeader()->getName()<br>
@@ -397,6 +412,13 @@ public:<br>
// Make the actual transforms.<br>
foldTerminators();<br>
<br>
+ if (!DeadLoopBlocks.empty()) {<br>
+ LLVM_DEBUG(dbgs() << "Deleting " << DeadLoopBlocks.size()<br>
+ << " dead blocks in loop " << L.getHeader()->getName()<br>
+ << "\n");<br>
+ deleteDeadLoopBlocks();<br>
+ }<br>
+<br>
#ifndef NDEBUG<br>
// Make sure that we have preserved all data structures after the transform.<br>
DT.verify();<br>
<br>
Modified: llvm/trunk/test/Transforms/LoopSimplifyCFG/constant-fold-branch.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopSimplifyCFG/constant-fold-branch.ll?rev=350045&r1=350044&r2=350045&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopSimplifyCFG/constant-fold-branch.ll?rev=350045&r1=350044&r2=350045&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/Transforms/LoopSimplifyCFG/constant-fold-branch.ll (original)<br>
+++ llvm/trunk/test/Transforms/LoopSimplifyCFG/constant-fold-branch.ll Sun Dec 23 22:06:17 2018<br>
@@ -88,18 +88,12 @@ define i32 @dead_block_test_branch_loop(<br>
; CHECK-NEXT: preheader:<br>
; CHECK-NEXT: br label [[HEADER:%.*]]<br>
; CHECK: header:<br>
-; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[PREHEADER:%.*]] ], [ [[I_INC:%.*]], [[BACKEDGE:%.*]] ]<br>
-; CHECK-NEXT: br i1 true, label [[BACKEDGE]], label [[DEAD:%.*]]<br>
-; CHECK: dead:<br>
-; CHECK-NEXT: [[I_2:%.*]] = add i32 [[I]], 1<br>
-; CHECK-NEXT: br label [[BACKEDGE]]<br>
-; CHECK: backedge:<br>
-; CHECK-NEXT: [[I_1:%.*]] = phi i32 [ [[I]], [[HEADER]] ], [ [[I_2]], [[DEAD]] ]<br>
-; CHECK-NEXT: [[I_INC]] = add i32 [[I_1]], 1<br>
+; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[PREHEADER:%.*]] ], [ [[I_INC:%.*]], [[HEADER]] ]<br>
+; CHECK-NEXT: [[I_INC]] = add i32 [[I]], 1<br>
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_INC]], [[END:%.*]]<br>
; CHECK-NEXT: br i1 [[CMP]], label [[HEADER]], label [[EXIT:%.*]]<br>
; CHECK: exit:<br>
-; CHECK-NEXT: [[I_INC_LCSSA:%.*]] = phi i32 [ [[I_INC]], [[BACKEDGE]] ]<br>
+; CHECK-NEXT: [[I_INC_LCSSA:%.*]] = phi i32 [ [[I_INC]], [[HEADER]] ]<br>
; CHECK-NEXT: ret i32 [[I_INC_LCSSA]]<br>
;<br>
preheader:<br>
@@ -129,22 +123,12 @@ define i32 @dead_block_test_switch_loop(<br>
; CHECK-NEXT: preheader:<br>
; CHECK-NEXT: br label [[HEADER:%.*]]<br>
; CHECK: header:<br>
-; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[PREHEADER:%.*]] ], [ [[I_INC:%.*]], [[BACKEDGE:%.*]] ]<br>
-; CHECK-NEXT: switch i32 1, label [[DEAD:%.*]] [<br>
-; CHECK-NEXT: i32 0, label [[DEAD]]<br>
-; CHECK-NEXT: i32 1, label [[BACKEDGE]]<br>
-; CHECK-NEXT: i32 2, label [[DEAD]]<br>
-; CHECK-NEXT: ]<br>
-; CHECK: dead:<br>
-; CHECK-NEXT: [[I_2:%.*]] = add i32 [[I]], 1<br>
-; CHECK-NEXT: br label [[BACKEDGE]]<br>
-; CHECK: backedge:<br>
-; CHECK-NEXT: [[I_1:%.*]] = phi i32 [ [[I]], [[HEADER]] ], [ [[I_2]], [[DEAD]] ]<br>
-; CHECK-NEXT: [[I_INC]] = add i32 [[I_1]], 1<br>
+; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[PREHEADER:%.*]] ], [ [[I_INC:%.*]], [[HEADER]] ]<br>
+; CHECK-NEXT: [[I_INC]] = add i32 [[I]], 1<br>
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_INC]], [[END:%.*]]<br>
; CHECK-NEXT: br i1 [[CMP]], label [[HEADER]], label [[EXIT:%.*]]<br>
; CHECK: exit:<br>
-; CHECK-NEXT: [[I_INC_LCSSA:%.*]] = phi i32 [ [[I_INC]], [[BACKEDGE]] ]<br>
+; CHECK-NEXT: [[I_INC_LCSSA:%.*]] = phi i32 [ [[I_INC]], [[HEADER]] ]<br>
; CHECK-NEXT: ret i32 [[I_INC_LCSSA]]<br>
;<br>
preheader:<br>
@@ -175,18 +159,12 @@ define i32 @dead_block_propogate_test_br<br>
; CHECK-NEXT: preheader:<br>
; CHECK-NEXT: br label [[HEADER:%.*]]<br>
; CHECK: header:<br>
-; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[PREHEADER:%.*]] ], [ [[I_INC:%.*]], [[BACKEDGE:%.*]] ]<br>
-; CHECK-NEXT: br i1 true, label [[BACKEDGE]], label [[DEAD:%.*]]<br>
-; CHECK: dead:<br>
-; CHECK-NEXT: [[I_2:%.*]] = add i32 [[I]], 1<br>
-; CHECK-NEXT: br label [[BACKEDGE]]<br>
-; CHECK: backedge:<br>
-; CHECK-NEXT: [[I_1:%.*]] = phi i32 [ [[I]], [[HEADER]] ], [ [[I_2]], [[DEAD]] ]<br>
-; CHECK-NEXT: [[I_INC]] = add i32 [[I_1]], 1<br>
+; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[PREHEADER:%.*]] ], [ [[I_INC:%.*]], [[HEADER]] ]<br>
+; CHECK-NEXT: [[I_INC]] = add i32 [[I]], 1<br>
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_INC]], [[END:%.*]]<br>
; CHECK-NEXT: br i1 [[CMP]], label [[HEADER]], label [[EXIT:%.*]]<br>
; CHECK: exit:<br>
-; CHECK-NEXT: [[I_INC_LCSSA:%.*]] = phi i32 [ [[I_INC]], [[BACKEDGE]] ]<br>
+; CHECK-NEXT: [[I_INC_LCSSA:%.*]] = phi i32 [ [[I_INC]], [[HEADER]] ]<br>
; CHECK-NEXT: ret i32 [[I_INC_LCSSA]]<br>
;<br>
preheader:<br>
@@ -219,22 +197,12 @@ define i32 @dead_block_propogate_test_sw<br>
; CHECK-NEXT: preheader:<br>
; CHECK-NEXT: br label [[HEADER:%.*]]<br>
; CHECK: header:<br>
-; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[PREHEADER:%.*]] ], [ [[I_INC:%.*]], [[BACKEDGE:%.*]] ]<br>
-; CHECK-NEXT: switch i32 1, label [[DEAD:%.*]] [<br>
-; CHECK-NEXT: i32 0, label [[DEAD]]<br>
-; CHECK-NEXT: i32 1, label [[BACKEDGE]]<br>
-; CHECK-NEXT: i32 2, label [[DEAD]]<br>
-; CHECK-NEXT: ]<br>
-; CHECK: dead:<br>
-; CHECK-NEXT: [[I_2:%.*]] = add i32 [[I]], 1<br>
-; CHECK-NEXT: br label [[BACKEDGE]]<br>
-; CHECK: backedge:<br>
-; CHECK-NEXT: [[I_1:%.*]] = phi i32 [ [[I]], [[HEADER]] ], [ [[I_2]], [[DEAD]] ]<br>
-; CHECK-NEXT: [[I_INC]] = add i32 [[I_1]], 1<br>
+; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[PREHEADER:%.*]] ], [ [[I_INC:%.*]], [[HEADER]] ]<br>
+; CHECK-NEXT: [[I_INC]] = add i32 [[I]], 1<br>
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_INC]], [[END:%.*]]<br>
; CHECK-NEXT: br i1 [[CMP]], label [[HEADER]], label [[EXIT:%.*]]<br>
; CHECK: exit:<br>
-; CHECK-NEXT: [[I_INC_LCSSA:%.*]] = phi i32 [ [[I_INC]], [[BACKEDGE]] ]<br>
+; CHECK-NEXT: [[I_INC_LCSSA:%.*]] = phi i32 [ [[I_INC]], [[HEADER]] ]<br>
; CHECK-NEXT: ret i32 [[I_INC_LCSSA]]<br>
;<br>
preheader:<br>
@@ -463,32 +431,19 @@ define i32 @dead_sub_loop_test_branch_lo<br>
; CHECK-NEXT: preheader:<br>
; CHECK-NEXT: br label [[HEADER:%.*]]<br>
; CHECK: header:<br>
-; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[PREHEADER:%.*]] ], [ [[I_INC:%.*]], [[BACKEDGE:%.*]] ]<br>
-; CHECK-NEXT: br i1 true, label [[LIVE_PREHEADER:%.*]], label [[DEAD_PREHEADER:%.*]]<br>
-; CHECK: live_preheader:<br>
+; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[PREHEADER:%.*]] ], [ [[I_INC:%.*]], [[EXIT_A:%.*]] ]<br>
; CHECK-NEXT: br label [[LIVE_LOOP:%.*]]<br>
; CHECK: live_loop:<br>
-; CHECK-NEXT: [[A:%.*]] = phi i32 [ 0, [[LIVE_PREHEADER]] ], [ [[A_INC:%.*]], [[LIVE_LOOP]] ]<br>
+; CHECK-NEXT: [[A:%.*]] = phi i32 [ 0, [[HEADER]] ], [ [[A_INC:%.*]], [[LIVE_LOOP]] ]<br>
; CHECK-NEXT: [[A_INC]] = add i32 [[A]], 1<br>
; CHECK-NEXT: [[CMP_A:%.*]] = icmp slt i32 [[A_INC]], [[END:%.*]]<br>
-; CHECK-NEXT: br i1 [[CMP_A]], label [[LIVE_LOOP]], label [[EXIT_A:%.*]]<br>
+; CHECK-NEXT: br i1 [[CMP_A]], label [[LIVE_LOOP]], label [[EXIT_A]]<br>
; CHECK: exit.a:<br>
-; CHECK-NEXT: br label [[BACKEDGE]]<br>
-; CHECK: dead_preheader:<br>
-; CHECK-NEXT: br label [[DEAD_LOOP:%.*]]<br>
-; CHECK: dead_loop:<br>
-; CHECK-NEXT: [[B:%.*]] = phi i32 [ 0, [[DEAD_PREHEADER]] ], [ [[B_INC:%.*]], [[DEAD_LOOP]] ]<br>
-; CHECK-NEXT: [[B_INC]] = add i32 [[B]], 1<br>
-; CHECK-NEXT: [[CMP_B:%.*]] = icmp slt i32 [[B_INC]], [[END]]<br>
-; CHECK-NEXT: br i1 [[CMP_B]], label [[DEAD_LOOP]], label [[EXIT_B:%.*]]<br>
-; CHECK: exit.b:<br>
-; CHECK-NEXT: br label [[BACKEDGE]]<br>
-; CHECK: backedge:<br>
; CHECK-NEXT: [[I_INC]] = add i32 [[I]], 1<br>
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_INC]], [[END]]<br>
; CHECK-NEXT: br i1 [[CMP]], label [[HEADER]], label [[EXIT:%.*]]<br>
; CHECK: exit:<br>
-; CHECK-NEXT: [[I_INC_LCSSA:%.*]] = phi i32 [ [[I_INC]], [[BACKEDGE]] ]<br>
+; CHECK-NEXT: [[I_INC_LCSSA:%.*]] = phi i32 [ [[I_INC]], [[EXIT_A]] ]<br>
; CHECK-NEXT: ret i32 [[I_INC_LCSSA]]<br>
;<br>
preheader:<br>
@@ -536,36 +491,19 @@ define i32 @dead_sub_loop_test_switch_lo<br>
; CHECK-NEXT: preheader:<br>
; CHECK-NEXT: br label [[HEADER:%.*]]<br>
; CHECK: header:<br>
-; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[PREHEADER:%.*]] ], [ [[I_INC:%.*]], [[BACKEDGE:%.*]] ]<br>
-; CHECK-NEXT: switch i32 1, label [[DEAD_PREHEADER:%.*]] [<br>
-; CHECK-NEXT: i32 0, label [[DEAD_PREHEADER]]<br>
-; CHECK-NEXT: i32 1, label [[LIVE_PREHEADER:%.*]]<br>
-; CHECK-NEXT: i32 2, label [[DEAD_PREHEADER]]<br>
-; CHECK-NEXT: ]<br>
-; CHECK: live_preheader:<br>
+; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[PREHEADER:%.*]] ], [ [[I_INC:%.*]], [[EXIT_A:%.*]] ]<br>
; CHECK-NEXT: br label [[LIVE_LOOP:%.*]]<br>
; CHECK: live_loop:<br>
-; CHECK-NEXT: [[A:%.*]] = phi i32 [ 0, [[LIVE_PREHEADER]] ], [ [[A_INC:%.*]], [[LIVE_LOOP]] ]<br>
+; CHECK-NEXT: [[A:%.*]] = phi i32 [ 0, [[HEADER]] ], [ [[A_INC:%.*]], [[LIVE_LOOP]] ]<br>
; CHECK-NEXT: [[A_INC]] = add i32 [[A]], 1<br>
; CHECK-NEXT: [[CMP_A:%.*]] = icmp slt i32 [[A_INC]], [[END:%.*]]<br>
-; CHECK-NEXT: br i1 [[CMP_A]], label [[LIVE_LOOP]], label [[EXIT_A:%.*]]<br>
+; CHECK-NEXT: br i1 [[CMP_A]], label [[LIVE_LOOP]], label [[EXIT_A]]<br>
; CHECK: exit.a:<br>
-; CHECK-NEXT: br label [[BACKEDGE]]<br>
-; CHECK: dead_preheader:<br>
-; CHECK-NEXT: br label [[DEAD_LOOP:%.*]]<br>
-; CHECK: dead_loop:<br>
-; CHECK-NEXT: [[B:%.*]] = phi i32 [ 0, [[DEAD_PREHEADER]] ], [ [[B_INC:%.*]], [[DEAD_LOOP]] ]<br>
-; CHECK-NEXT: [[B_INC]] = add i32 [[B]], 1<br>
-; CHECK-NEXT: [[CMP_B:%.*]] = icmp slt i32 [[B_INC]], [[END]]<br>
-; CHECK-NEXT: br i1 [[CMP_B]], label [[DEAD_LOOP]], label [[EXIT_B:%.*]]<br>
-; CHECK: exit.b:<br>
-; CHECK-NEXT: br label [[BACKEDGE]]<br>
-; CHECK: backedge:<br>
; CHECK-NEXT: [[I_INC]] = add i32 [[I]], 1<br>
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_INC]], [[END]]<br>
; CHECK-NEXT: br i1 [[CMP]], label [[HEADER]], label [[EXIT:%.*]]<br>
; CHECK: exit:<br>
-; CHECK-NEXT: [[I_INC_LCSSA:%.*]] = phi i32 [ [[I_INC]], [[BACKEDGE]] ]<br>
+; CHECK-NEXT: [[I_INC_LCSSA:%.*]] = phi i32 [ [[I_INC]], [[EXIT_A]] ]<br>
; CHECK-NEXT: ret i32 [[I_INC_LCSSA]]<br>
;<br>
preheader:<br>
@@ -898,18 +836,12 @@ define i32 @partial_sub_loop_test_branch<br>
; CHECK-NEXT: [[J:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[J_INC:%.*]], [[OUTER_BACKEDGE:%.*]] ]<br>
; CHECK-NEXT: br label [[HEADER:%.*]]<br>
; CHECK: header:<br>
-; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[OUTER_HEADER]] ], [ [[I_INC:%.*]], [[BACKEDGE:%.*]] ]<br>
-; CHECK-NEXT: br i1 true, label [[BACKEDGE]], label [[DEAD:%.*]]<br>
-; CHECK: dead:<br>
-; CHECK-NEXT: [[I_2:%.*]] = add i32 [[I]], 1<br>
-; CHECK-NEXT: br label [[BACKEDGE]]<br>
-; CHECK: backedge:<br>
-; CHECK-NEXT: [[I_1:%.*]] = phi i32 [ [[I]], [[HEADER]] ], [ [[I_2]], [[DEAD]] ]<br>
-; CHECK-NEXT: [[I_INC]] = add i32 [[I_1]], 1<br>
+; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[OUTER_HEADER]] ], [ [[I_INC:%.*]], [[HEADER]] ]<br>
+; CHECK-NEXT: [[I_INC]] = add i32 [[I]], 1<br>
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_INC]], [[END:%.*]]<br>
; CHECK-NEXT: br i1 [[CMP]], label [[HEADER]], label [[OUTER_BACKEDGE]]<br>
; CHECK: outer_backedge:<br>
-; CHECK-NEXT: [[I_INC_LCSSA:%.*]] = phi i32 [ [[I_INC]], [[BACKEDGE]] ]<br>
+; CHECK-NEXT: [[I_INC_LCSSA:%.*]] = phi i32 [ [[I_INC]], [[HEADER]] ]<br>
; CHECK-NEXT: [[J_INC]] = add i32 [[J]], 1<br>
; CHECK-NEXT: [[CMP_J:%.*]] = icmp slt i32 [[J_INC]], [[END]]<br>
; CHECK-NEXT: br i1 [[CMP_J]], label [[OUTER_HEADER]], label [[EXIT:%.*]]<br>
@@ -958,22 +890,12 @@ define i32 @partial_sub_loop_test_switch<br>
; CHECK-NEXT: [[J:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[J_INC:%.*]], [[OUTER_BACKEDGE:%.*]] ]<br>
; CHECK-NEXT: br label [[HEADER:%.*]]<br>
; CHECK: header:<br>
-; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[OUTER_HEADER]] ], [ [[I_INC:%.*]], [[BACKEDGE:%.*]] ]<br>
-; CHECK-NEXT: switch i32 1, label [[DEAD:%.*]] [<br>
-; CHECK-NEXT: i32 0, label [[DEAD]]<br>
-; CHECK-NEXT: i32 1, label [[BACKEDGE]]<br>
-; CHECK-NEXT: i32 2, label [[DEAD]]<br>
-; CHECK-NEXT: ]<br>
-; CHECK: dead:<br>
-; CHECK-NEXT: [[I_2:%.*]] = add i32 [[I]], 1<br>
-; CHECK-NEXT: br label [[BACKEDGE]]<br>
-; CHECK: backedge:<br>
-; CHECK-NEXT: [[I_1:%.*]] = phi i32 [ [[I]], [[HEADER]] ], [ [[I_2]], [[DEAD]] ]<br>
-; CHECK-NEXT: [[I_INC]] = add i32 [[I_1]], 1<br>
+; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[OUTER_HEADER]] ], [ [[I_INC:%.*]], [[HEADER]] ]<br>
+; CHECK-NEXT: [[I_INC]] = add i32 [[I]], 1<br>
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I_INC]], [[END:%.*]]<br>
; CHECK-NEXT: br i1 [[CMP]], label [[HEADER]], label [[OUTER_BACKEDGE]]<br>
; CHECK: outer_backedge:<br>
-; CHECK-NEXT: [[I_INC_LCSSA:%.*]] = phi i32 [ [[I_INC]], [[BACKEDGE]] ]<br>
+; CHECK-NEXT: [[I_INC_LCSSA:%.*]] = phi i32 [ [[I_INC]], [[HEADER]] ]<br>
; CHECK-NEXT: [[J_INC]] = add i32 [[J]], 1<br>
; CHECK-NEXT: [[CMP_J:%.*]] = icmp slt i32 [[J_INC]], [[END]]<br>
; CHECK-NEXT: br i1 [[CMP_J]], label [[OUTER_HEADER]], label [[EXIT:%.*]]<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><u></u><u></u></p>
</blockquote>
</div>
</div>
</div>
</blockquote></div>