<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:"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.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;}
--></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 for reverting the patch. I forgot to update Phis properly. Will fix and resubmit shortly.<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"> Benjamin Kramer <benny.kra@gmail.com>
<br>
<b>Sent:</b> Tuesday, November 20, 2018 3:05 AM<br>
<b>To:</b> Maxim Kazantsev <max.kazantsev@azul.com><br>
<b>Cc:</b> llvm-commits <llvm-commits@lists.llvm.org><br>
<b>Subject:</b> Re: [llvm] r347183 - [LoopSimplifyCFG] Teach LoopSimplifyCFG to constant-fold branches and switches<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<p class="MsoNormal">This crashes clang while building libxml. reverted in r347260<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">$ clang -O3 -fexperimental-new-pass-manager t.i -c -o /dev/null -w<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">PHINode should have one entry for each predecessor of its parent basic block!<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> %h.0 = phi i32 [ 0, %while.body ], [ 1, %for.body.if.end5.loopexit_crit_edge ], [ 0, %for.cond.preheader ]<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">in function g<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">fatal error: error in backend: Broken function found, compilation aborted!<o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Mon, Nov 19, 2018 at 6:57 AM 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 Nov 18 21:54:38 2018<br>
New Revision: 347183<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=347183&view=rev" target="_blank">
http://llvm.org/viewvc/llvm-project?rev=347183&view=rev</a><br>
Log:<br>
[LoopSimplifyCFG] Teach LoopSimplifyCFG to constant-fold branches and switches<br>
<br>
This patch introduces infrastructure and the simplest case for constant-folding<br>
of branch and switch instructions within loop into unconditional branches.<br>
It is useful as a cleanup for such passes as loop unswitching that sometimes<br>
produce such branches.<br>
<br>
Only the simplest case supported in this patch: after the folding, no block<br>
should become dead or stop being part of the loop. Support for more<br>
sophisticated cases will go separately in follow-up patches.<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D54021" target="_blank">
https://reviews.llvm.org/D54021</a><br>
Reviewed By: anna<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=347183&r1=347182&r2=347183&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp?rev=347183&r1=347182&r2=347183&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp Sun Nov 18 21:54:38 2018<br>
@@ -41,6 +41,316 @@ using namespace llvm;<br>
<br>
#define DEBUG_TYPE "loop-simplifycfg"<br>
<br>
+STATISTIC(NumTerminatorsFolded,<br>
+ "Number of terminators folded to unconditional branches");<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>
+/// return nullptr.<br>
+static BasicBlock *getOnlyLiveSuccessor(BasicBlock *BB) {<br>
+ Instruction *TI = BB->getTerminator();<br>
+ if (BranchInst *BI = dyn_cast<BranchInst>(TI)) {<br>
+ if (BI->isUnconditional())<br>
+ return nullptr;<br>
+ if (BI->getSuccessor(0) == BI->getSuccessor(1))<br>
+ return BI->getSuccessor(0);<br>
+ ConstantInt *Cond = dyn_cast<ConstantInt>(BI->getCondition());<br>
+ if (!Cond)<br>
+ return nullptr;<br>
+ return Cond->isZero() ? BI->getSuccessor(1) : BI->getSuccessor(0);<br>
+ }<br>
+<br>
+ if (SwitchInst *SI = dyn_cast<SwitchInst>(TI)) {<br>
+ auto *CI = dyn_cast<ConstantInt>(SI->getCondition());<br>
+ if (!CI)<br>
+ return nullptr;<br>
+ for (auto Case : SI->cases())<br>
+ if (Case.getCaseValue() == CI)<br>
+ return Case.getCaseSuccessor();<br>
+ return SI->getDefaultDest();<br>
+ }<br>
+<br>
+ return nullptr;<br>
+}<br>
+<br>
+/// Helper class that can turn branches and switches with constant conditions<br>
+/// into unconditional branches.<br>
+class ConstantTerminatorFoldingImpl {<br>
+private:<br>
+ Loop &L;<br>
+ LoopInfo &LI;<br>
+ DominatorTree &DT;<br>
+<br>
+ // Whether or not the current loop will still exist after terminator constant<br>
+ // folding will be done. In theory, there are two ways how it can happen:<br>
+ // 1. Loop's latch(es) become unreachable from loop header;<br>
+ // 2. Loop's header becomes unreachable from method entry.<br>
+ // In practice, the second situation is impossible because we only modify the<br>
+ // current loop and its preheader and do not affect preheader's reachibility<br>
+ // from any other block. So this variable set to true means that loop's latch<br>
+ // has become unreachable from loop header.<br>
+ bool DeleteCurrentLoop = false;<br>
+<br>
+ // The blocks of the original loop that will still be reachable from entry<br>
+ // after the constant folding.<br>
+ SmallPtrSet<BasicBlock *, 8> LiveLoopBlocks;<br>
+ // The blocks of the original loop that will become unreachable from entry<br>
+ // after the constant folding.<br>
+ SmallPtrSet<BasicBlock *, 8> DeadLoopBlocks;<br>
+ // The exits of the original loop that will still be reachable from entry<br>
+ // after the constant folding.<br>
+ SmallPtrSet<BasicBlock *, 8> LiveExitBlocks;<br>
+ // The exits of the original loop that will become unreachable from entry<br>
+ // after the constant folding.<br>
+ SmallPtrSet<BasicBlock *, 8> DeadExitBlocks;<br>
+ // The blocks that will still be a part of the current loop after folding.<br>
+ SmallPtrSet<BasicBlock *, 8> BlocksInLoopAfterFolding;<br>
+ // The blocks that have terminators with constant condition that can be<br>
+ // folded. Note: fold candidates should be in L but not in any of its<br>
+ // subloops to avoid complex LI updates.<br>
+ SmallVector<BasicBlock *, 8> FoldCandidates;<br>
+<br>
+ void dump() const {<br>
+ dbgs() << "Constant terminator folding for loop " << L << "\n";<br>
+ dbgs() << "After terminator constant-folding, the loop will";<br>
+ if (!DeleteCurrentLoop)<br>
+ dbgs() << " not";<br>
+ dbgs() << " be destroyed\n";<br>
+ dbgs() << "Blocks in which we can constant-fold terminator:\n";<br>
+ for (const BasicBlock *BB : FoldCandidates)<br>
+ dbgs() << "\t" << BB->getName() << "\n";<br>
+ auto PrintOutSet = [&](const char *Message,<br>
+ const SmallPtrSetImpl<BasicBlock *> &S) {<br>
+ dbgs() << Message << "\n";<br>
+ for (const BasicBlock *BB : S)<br>
+ dbgs() << "\t" << BB->getName() << "\n";<br>
+ };<br>
+ PrintOutSet("Live blocks from the original loop:", LiveLoopBlocks);<br>
+ PrintOutSet("Dead blocks from the original loop:", DeadLoopBlocks);<br>
+ PrintOutSet("Live exit blocks:", LiveExitBlocks);<br>
+ PrintOutSet("Dead exit blocks:", DeadExitBlocks);<br>
+ if (!DeleteCurrentLoop)<br>
+ PrintOutSet("The following blocks will still be part of the loop:",<br>
+ BlocksInLoopAfterFolding);<br>
+ }<br>
+<br>
+ /// Fill all information about status of blocks and exits of the current loop<br>
+ /// if constant folding of all branches will be done.<br>
+ void analyze() {<br>
+ LoopBlocksDFS DFS(&L);<br>
+ DFS.perform(&LI);<br>
+ assert(DFS.isComplete() && "DFS is expected to be finished");<br>
+<br>
+ // Collect live and dead loop blocks and exits.<br>
+ SmallPtrSet<BasicBlock *, 8> ExitBlocks;<br>
+ LiveLoopBlocks.insert(L.getHeader());<br>
+ for (auto I = DFS.beginRPO(), E = DFS.endRPO(); I != E; ++I) {<br>
+ BasicBlock *BB = *I;<br>
+<br>
+ // If a loop block wasn't marked as live so far, then it's dead.<br>
+ if (!LiveLoopBlocks.count(BB)) {<br>
+ DeadLoopBlocks.insert(BB);<br>
+ continue;<br>
+ }<br>
+<br>
+ BasicBlock *TheOnlySucc = getOnlyLiveSuccessor(BB);<br>
+<br>
+ // If a block has only one live successor, it's a candidate on constant<br>
+ // folding. Only handle blocks from current loop: branches in child loops<br>
+ // are skipped because if they can be folded, they should be folded during<br>
+ // the processing of child loops.<br>
+ if (TheOnlySucc && LI.getLoopFor(BB) == &L)<br>
+ FoldCandidates.push_back(BB);<br>
+<br>
+ // Handle successors.<br>
+ auto ProcessSuccessor = [&](BasicBlock *Succ, bool IsLive) {<br>
+ if (!L.contains(Succ)) {<br>
+ if (IsLive)<br>
+ LiveExitBlocks.insert(Succ);<br>
+ ExitBlocks.insert(Succ);<br>
+ } else if (IsLive)<br>
+ LiveLoopBlocks.insert(Succ);<br>
+ };<br>
+ for (BasicBlock *Succ : successors(BB))<br>
+ ProcessSuccessor(Succ, !TheOnlySucc || TheOnlySucc == Succ);<br>
+ }<br>
+<br>
+ // Sanity check: amount of dead and live loop blocks should match the total<br>
+ // number of blocks in loop.<br>
+ assert(L.getNumBlocks() == LiveLoopBlocks.size() + DeadLoopBlocks.size() &&<br>
+ "Malformed block sets?");<br>
+<br>
+ // Now, all exit blocks that are not marked as live are dead.<br>
+ for (auto *ExitBlock : ExitBlocks)<br>
+ if (!LiveExitBlocks.count(ExitBlock))<br>
+ DeadExitBlocks.insert(ExitBlock);<br>
+<br>
+ // Whether or not the edge From->To will still be present in graph after the<br>
+ // folding.<br>
+ auto IsEdgeLive = [&](BasicBlock *From, BasicBlock *To) {<br>
+ if (!LiveLoopBlocks.count(From))<br>
+ return false;<br>
+ BasicBlock *TheOnlySucc = getOnlyLiveSuccessor(From);<br>
+ return !TheOnlySucc || TheOnlySucc == To;<br>
+ };<br>
+<br>
+ // The loop will not be destroyed if its latch is live.<br>
+ DeleteCurrentLoop = !IsEdgeLive(L.getLoopLatch(), L.getHeader());<br>
+<br>
+ // If we are going to delete the current loop completely, no extra analysis<br>
+ // is needed.<br>
+ if (DeleteCurrentLoop)<br>
+ return;<br>
+<br>
+ // Otherwise, we should check which blocks will still be a part of the<br>
+ // current loop after the transform.<br>
+ BlocksInLoopAfterFolding.insert(L.getLoopLatch());<br>
+ // If the loop is live, then we should compute what blocks are still in<br>
+ // loop after all branch folding has been done. A block is in loop if<br>
+ // it has a live edge to another block that is in the loop; by definition,<br>
+ // latch is in the loop.<br>
+ auto BlockIsInLoop = [&](BasicBlock *BB) {<br>
+ return any_of(successors(BB), [&](BasicBlock *Succ) {<br>
+ return BlocksInLoopAfterFolding.count(Succ) && IsEdgeLive(BB, Succ);<br>
+ });<br>
+ };<br>
+ for (auto I = DFS.beginPostorder(), E = DFS.endPostorder(); I != E; ++I) {<br>
+ BasicBlock *BB = *I;<br>
+ if (BlockIsInLoop(BB))<br>
+ BlocksInLoopAfterFolding.insert(BB);<br>
+ }<br>
+<br>
+ // Sanity check: header must be in loop.<br>
+ assert(BlocksInLoopAfterFolding.count(L.getHeader()) &&<br>
+ "Header not in loop?");<br>
+ }<br>
+<br>
+ /// Constant-fold terminators of blocks acculumated in FoldCandidates into the<br>
+ /// unconditional branches.<br>
+ void foldTerminators() {<br>
+ DomTreeUpdater DTU(DT, DomTreeUpdater::UpdateStrategy::Eager);<br>
+<br>
+ for (BasicBlock *BB : FoldCandidates) {<br>
+ assert(LI.getLoopFor(BB) == &L && "Should be a loop block!");<br>
+ BasicBlock *TheOnlySucc = getOnlyLiveSuccessor(BB);<br>
+ assert(TheOnlySucc && "Should have one live successor!");<br>
+<br>
+ LLVM_DEBUG(dbgs() << "Replacing terminator of " << BB->getName()<br>
+ << " with an unconditional branch to the block "<br>
+ << TheOnlySucc->getName() << "\n");<br>
+<br>
+ SmallPtrSet<BasicBlock *, 2> DeadSuccessors;<br>
+ // Remove all BB's successors except for the live one.<br>
+ for (auto *Succ : successors(BB))<br>
+ if (Succ != TheOnlySucc)<br>
+ DeadSuccessors.insert(Succ);<br>
+<br>
+ IRBuilder<> Builder(BB->getContext());<br>
+ Instruction *Term = BB->getTerminator();<br>
+ Builder.SetInsertPoint(Term);<br>
+ Builder.CreateBr(TheOnlySucc);<br>
+ Term->eraseFromParent();<br>
+<br>
+ for (auto *DeadSucc : DeadSuccessors)<br>
+ DTU.deleteEdge(BB, DeadSucc);<br>
+<br>
+ ++NumTerminatorsFolded;<br>
+ }<br>
+ }<br>
+<br>
+public:<br>
+ ConstantTerminatorFoldingImpl(Loop &L, LoopInfo &LI, DominatorTree &DT)<br>
+ : L(L), LI(LI), DT(DT) {}<br>
+ bool run() {<br>
+ assert(L.getLoopLatch() && "Should be single latch!");<br>
+<br>
+ // Collect all available information about status of blocks after constant<br>
+ // folding.<br>
+ analyze();<br>
+<br>
+ LLVM_DEBUG(dbgs() << "In function " << L.getHeader()->getParent()->getName()<br>
+ << ": ");<br>
+<br>
+ // Nothing to constant-fold.<br>
+ if (FoldCandidates.empty()) {<br>
+ LLVM_DEBUG(<br>
+ dbgs() << "No constant terminator folding candidates found in loop "<br>
+ << L.getHeader()->getName() << "\n");<br>
+ return false;<br>
+ }<br>
+<br>
+ // TODO: Support deletion of the current loop.<br>
+ if (DeleteCurrentLoop) {<br>
+ LLVM_DEBUG(<br>
+ dbgs()<br>
+ << "Give up constant terminator folding in loop "<br>
+ << L.getHeader()->getName()<br>
+ << ": we don't currently support deletion of the current loop.\n");<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>
+ << L.getHeader()->getName()<br>
+ << ": we don't currently support dead loop exits.\n");<br>
+ return false;<br>
+ }<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>
+ LLVM_DEBUG(<br>
+ dbgs() << "Give up constant terminator folding in loop "<br>
+ << L.getHeader()->getName()<br>
+ << ": we don't currently"<br>
+ " support blocks that are not dead, but will stop "<br>
+ "being a part of the loop after constant-folding.\n");<br>
+ return false;<br>
+ }<br>
+<br>
+ // Dump analysis results.<br>
+ LLVM_DEBUG(dump());<br>
+<br>
+ LLVM_DEBUG(dbgs() << "Constant-folding " << FoldCandidates.size()<br>
+ << " terminators in loop " << L.getHeader()->getName()<br>
+ << "\n");<br>
+<br>
+ // Make the actual transforms.<br>
+ foldTerminators();<br>
+<br>
+#ifndef NDEBUG<br>
+ // Make sure that we have preserved all data structures after the transform.<br>
+ DT.verify();<br>
+ assert(DT.isReachableFromEntry(L.getHeader()));<br>
+ LI.verify(DT);<br>
+#endif<br>
+<br>
+ return true;<br>
+ }<br>
+};<br>
+<br>
+/// Turn branches and switches with known constant conditions into unconditional<br>
+/// branches.<br>
+static bool constantFoldTerminators(Loop &L, DominatorTree &DT, LoopInfo &LI) {<br>
+ // To keep things simple, only process loops with single latch. We<br>
+ // canonicalize most loops to this form. We can support multi-latch if needed.<br>
+ if (!L.getLoopLatch())<br>
+ return false;<br>
+<br>
+ ConstantTerminatorFoldingImpl BranchFolder(L, LI, DT);<br>
+ return BranchFolder.run();<br>
+}<br>
+<br>
static bool mergeBlocksIntoPredecessors(Loop &L, DominatorTree &DT,<br>
LoopInfo &LI, MemorySSAUpdater *MSSAU) {<br>
bool Changed = false;<br>
@@ -73,6 +383,9 @@ static bool simplifyLoopCFG(Loop &L, Dom<br>
ScalarEvolution &SE, MemorySSAUpdater *MSSAU) {<br>
bool Changed = false;<br>
<br>
+ // Constant-fold terminators with known constant conditions.<br>
+ Changed |= constantFoldTerminators(L, DT, LI);<br>
+<br>
// Eliminate unconditional branches by merging blocks into their predecessors.<br>
Changed |= mergeBlocksIntoPredecessors(L, DT, LI, MSSAU);<br>
<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=347183&r1=347182&r2=347183&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopSimplifyCFG/constant-fold-branch.ll?rev=347183&r1=347182&r2=347183&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 Nov 18 21:54:38 2018<br>
@@ -1,10 +1,53 @@<br>
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py<br>
-; RUN: opt -S -loop-simplifycfg < %s | FileCheck %s<br>
-; RUN: opt -S -passes='require<domtree>,loop(simplify-cfg)' < %s | FileCheck %s<br>
-; RUN: opt -S -loop-simplifycfg -enable-mssa-loop-dependency=true -verify-memoryssa < %s | FileCheck %s<br>
+; RUN: opt -S -loop-simplifycfg -debug-only=loop-simplifycfg 2>&1 < %s | FileCheck %s<br>
+; RUN: opt -S -passes='require<domtree>,loop(simplify-cfg)' -debug-only=loop-simplifycfg 2>&1 < %s | FileCheck %s<br>
+; RUN: opt -S -loop-simplifycfg -enable-mssa-loop-dependency=true -verify-memoryssa -debug-only=loop-simplifycfg 2>&1 < %s | FileCheck %s<br>
<br>
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:1"<br>
<br>
+; CHECK-LABEL: In function dead_backedge_test_branch_loop: Give up constant terminator folding in loop header: we don't currently support blocks that are not dead, but will stop being a part of the loop after constant-folding.<br>
+; CHECK-LABEL: In function dead_backedge_test_switch_loop: Give up constant terminator folding in loop header: we don't currently support blocks that are not dead, but will stop being a part of the loop after constant-folding.<br>
+; CHECK-LABEL: In function dead_block_test_branch_loop: Give up constant terminator folding in loop header: we don't currently support deletion of dead in-loop blocks.<br>
+; CHECK-LABEL: In function dead_block_test_switch_loop: Give up constant terminator folding in loop header: we don't currently support deletion of dead in-loop blocks.<br>
+; CHECK-LABEL: In function dead_block_propogate_test_branch_loop: Give up constant terminator folding in loop header: we don't currently support deletion of dead in-loop blocks.<br>
+; CHECK-LABEL: In function dead_block_propogate_test_switch_loop: Give up constant terminator folding in loop header: we don't currently support deletion of dead in-loop blocks.<br>
+; CHECK-LABEL: In function dead_exit_test_branch_loop: Give up constant terminator folding in loop header: we don't currently support dead loop exits.<br>
+; CHECK-LABEL: In function dead_exit_test_switch_loop: Give up constant terminator folding in loop header: we don't currently support dead loop exits.<br>
+; CHECK-LABEL: In function dead_loop_test_branch_loop: Give up constant terminator folding in loop header: we don't currently support deletion of the current loop.<br>
+; CHECK-LABEL: In function dead_loop_test_switch_loop: Give up constant terminator folding in loop header: we don't currently support deletion of the current loop.<br>
+; CHECK-LABEL: In function dead_sub_loop_test_branch_loop: No constant terminator folding candidates found in loop dead_loop<br>
+; CHECK-LABEL: In function dead_sub_loop_test_branch_loop: No constant terminator folding candidates found in loop live_loop<br>
+; CHECK-LABEL: In function dead_sub_loop_test_branch_loop: Give up constant terminator folding in loop header: we don't currently support deletion of dead in-loop blocks.<br>
+; CHECK-LABEL: In function dead_sub_loop_test_switch_loop: No constant terminator folding candidates found in loop live_loop<br>
+; CHECK-LABEL: In function dead_sub_loop_test_switch_loop: No constant terminator folding candidates found in loop dead_loop<br>
+; CHECK-LABEL: In function dead_sub_loop_test_switch_loop: Give up constant terminator folding in loop header: we don't currently support deletion of dead in-loop blocks.<br>
+; CHECK-LABEL: In function inf_loop_test_branch_loop: Give up constant terminator folding in loop header: we don't currently support deletion of dead in-loop blocks.<br>
+; CHECK-LABEL: In function inf_loop_test_switch_loop: Give up constant terminator folding in loop header: we don't currently support deletion of dead in-loop blocks.<br>
+; CHECK-LABEL: In function live_block_test_branch_loop: Constant terminator folding for loop Loop at depth 1 containing: %header<header>,%check,%live,%backedge<latch><exiting><br>
+; CHECK: Replacing terminator of check with an unconditional branch to the block backedge<br>
+; CHECK-LABEL: In function live_block_test_switch_loop: Constant terminator folding for loop Loop at depth 1 containing: %header<header>,%check,%live,%backedge<latch><exiting><br>
+; CHECK: Replacing terminator of check with an unconditional branch to the block backedge<br>
+; CHECK-LABEL: In function partial_sub_loop_test_branch_loop: Give up constant terminator folding in loop header: we don't currently support deletion of dead in-loop blocks.<br>
+; CHECK-LABEL: In function partial_sub_loop_test_branch_loop: No constant terminator folding candidates found in loop outer_header<br>
+; CHECK-LABEL: In function partial_sub_loop_test_switch_loop: Give up constant terminator folding in loop header: we don't currently support deletion of dead in-loop blocks.<br>
+; CHECK-LABEL: In function partial_sub_loop_test_switch_loop: No constant terminator folding candidates found in loop outer_header<br>
+; CHECK-LABEL: In function full_sub_loop_test_branch_loop: Give up constant terminator folding in loop header: we don't currently support deletion of the current loop.<br>
+; CHECK-LABEL: In function full_sub_loop_test_branch_loop: No constant terminator folding candidates found in loop outer_header<br>
+; CHECK-LABEL: In function full_sub_loop_test_switch_loop: Give up constant terminator folding in loop header: we don't currently support deletion of the current loop.<br>
+; CHECK-LABEL: In function full_sub_loop_test_switch_loop: No constant terminator folding candidates found in loop outer_header<br>
+; CHECK-LABEL: In function full_sub_loop_test_branch_loop_inverse_1: Give up constant terminator folding in loop header: we don't currently support deletion of the current loop.<br>
+; CHECK-LABEL: In function full_sub_loop_test_branch_loop_inverse_1: No constant terminator folding candidates found in loop outer_header<br>
+; CHECK-LABEL: In function full_sub_loop_test_switch_loop_inverse_1: Give up constant terminator folding in loop header: we don't currently support deletion of the current loop.<br>
+; CHECK-LABEL: In function full_sub_loop_test_switch_loop_inverse_1: No constant terminator folding candidates found in loop outer_header<br>
+; CHECK-LABEL: In function full_sub_loop_test_branch_loop_inverse_2: Give up constant terminator folding in loop header: we don't currently support dead loop exits.<br>
+; CHECK-LABEL: In function full_sub_loop_test_branch_loop_inverse_2: No constant terminator folding candidates found in loop outer_header<br>
+; CHECK-LABEL: In function full_sub_loop_test_switch_loop_inverse_2: Give up constant terminator folding in loop header: we don't currently support dead loop exits.<br>
+; CHECK-LABEL: In function full_sub_loop_test_switch_loop_inverse_2: No constant terminator folding candidates found in loop outer_header<br>
+; CHECK-LABEL: In function full_sub_loop_test_branch_loop_inverse_3: Give up constant terminator folding in loop header: we don't currently support deletion of dead in-loop blocks.<br>
+; CHECK-LABEL: In function full_sub_loop_test_branch_loop_inverse_3: No constant terminator folding candidates found in loop outer_header<br>
+; CHECK-LABEL: In function full_sub_loop_test_switch_loop_inverse_3: Give up constant terminator folding in loop header: we don't currently support deletion of dead in-loop blocks.<br>
+; CHECK-LABEL: In function full_sub_loop_test_switch_loop_inverse_3: No constant terminator folding candidates found in loop outer_header<br>
+<br>
; Make sure that we can eliminate a provably dead backedge.<br>
define i32 @dead_backedge_test_branch_loop(i32 %end) {<br>
; CHECK-LABEL: @dead_backedge_test_branch_loop(<br>
@@ -707,7 +750,7 @@ define i32 @live_block_test_branch_loop(<br>
; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[PREHEADER:%.*]] ], [ [[I_INC:%.*]], [[BACKEDGE:%.*]] ]<br>
; CHECK-NEXT: br i1 [[C:%.*]], label [[CHECK:%.*]], label [[LIVE:%.*]]<br>
; CHECK: check:<br>
-; CHECK-NEXT: br i1 true, label [[BACKEDGE]], label [[LIVE]]<br>
+; CHECK-NEXT: br label [[BACKEDGE]]<br>
; CHECK: live:<br>
; CHECK-NEXT: [[I_2:%.*]] = add i32 [[I]], 1<br>
; CHECK-NEXT: br label [[BACKEDGE]]<br>
@@ -752,11 +795,7 @@ define i32 @live_block_test_switch_loop(<br>
; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[PREHEADER:%.*]] ], [ [[I_INC:%.*]], [[BACKEDGE:%.*]] ]<br>
; CHECK-NEXT: br i1 [[C:%.*]], label [[CHECK:%.*]], label [[LIVE:%.*]]<br>
; CHECK: check:<br>
-; CHECK-NEXT: switch i32 1, label [[LIVE]] [<br>
-; CHECK-NEXT: i32 0, label [[LIVE]]<br>
-; CHECK-NEXT: i32 1, label [[BACKEDGE]]<br>
-; CHECK-NEXT: i32 2, label [[LIVE]]<br>
-; CHECK-NEXT: ]<br>
+; CHECK-NEXT: br label [[BACKEDGE]]<br>
; CHECK: live:<br>
; CHECK-NEXT: [[I_2:%.*]] = add i32 [[I]], 1<br>
; CHECK-NEXT: br label [[BACKEDGE]]<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>