<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:2.0cm 42.5pt 2.0cm 3.0cm;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:511147195;
mso-list-type:hybrid;
mso-list-template-ids:-1350165984 -766368454 68747267 68747269 68747265 68747267 68747269 68747265 68747267 68747269;}
@list l0:level1
{mso-level-start-at:0;
mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;
mso-fareast-font-family:Calibri;
mso-bidi-font-family:"Times New Roman";}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:"Courier New";}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-18.0pt;
font-family:Wingdings;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="RU" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">Thanks Jordan!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language: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.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">--Max<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Jordan Rupprecht <rupprecht@google.com>
<br>
<b>Sent:</b> Friday, December 28, 2018 7:31 AM<br>
<b>To:</b> Maxim Kazantsev <max.kazantsev@azul.com><br>
<b>Cc:</b> llvm-commits@lists.llvm.org<br>
<b>Subject:</b> Re: [llvm] r350045 - Return "[LoopSimplifyCFG] Delete dead in-loop blocks"<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></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:<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></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<o:p></o:p></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)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">|| BB->getSinglePredecessor() == BB) && "Block is not dead!"' failed.<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Stack:<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">1. <eof> parser at end of file<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">2. Optimizer<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">...<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> #9 0x00007f9af5ad4719 llvm::DeleteDeadBlock(llvm::BasicBlock*, llvm::DomTreeUpdater*) ~/src/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp:55:25<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">#10 0x00007f9af6709f7d ConstantTerminatorFoldingImpl::deleteDeadLoopBlocks() ~/src/llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp:400:7<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></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">llvm-commits@lists.llvm.org</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;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><o:p></o:p></p>
</blockquote>
</div>
</div>
</body>
</html>