<div dir="ltr">It's failing with -Asserts. Investigating.<div><a href="http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/46076">http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/46076</a><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Dec 6, 2016 at 8:14 AM Davide Italiano via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: davide<br class="gmail_msg">
Date: Mon Dec  5 17:04:21 2016<br class="gmail_msg">
New Revision: 288725<br class="gmail_msg">
<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=288725&view=rev" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project?rev=288725&view=rev</a><br class="gmail_msg">
Log:<br class="gmail_msg">
[SCCP] Remove manual folding of terminator instructions.<br class="gmail_msg">
<br class="gmail_msg">
There are two cases handled here:<br class="gmail_msg">
1) a branch on undef<br class="gmail_msg">
2) a switch with an undef condition.<br class="gmail_msg">
<br class="gmail_msg">
Both cases are currently handled by ResolvedUndefsIn. If we have<br class="gmail_msg">
a branch on undef, we force its value to false (which is trivially<br class="gmail_msg">
foldable). If we have a switch on undef, we force to the first<br class="gmail_msg">
constant (which is also foldable).<br class="gmail_msg">
<br class="gmail_msg">
Modified:<br class="gmail_msg">
    llvm/trunk/lib/Transforms/Scalar/SCCP.cpp<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/Transforms/Scalar/SCCP.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=288725&r1=288724&r2=288725&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=288725&r1=288724&r2=288725&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/Transforms/Scalar/SCCP.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/Transforms/Scalar/SCCP.cpp Mon Dec  5 17:04:21 2016<br class="gmail_msg">
@@ -1828,33 +1828,8 @@ static bool runIPSCCP(Module &M, const D<br class="gmail_msg">
         // Ignore blockaddress users; BasicBlock's dtor will handle them.<br class="gmail_msg">
         if (!I) continue;<br class="gmail_msg">
<br class="gmail_msg">
-        bool Folded = ConstantFoldTerminator(I->getParent());<br class="gmail_msg">
-        if (!Folded) {<br class="gmail_msg">
-          // The constant folder may not have been able to fold the terminator<br class="gmail_msg">
-          // if this is a branch or switch on undef.  Fold it manually as a<br class="gmail_msg">
-          // branch to the first successor.<br class="gmail_msg">
-#ifndef NDEBUG<br class="gmail_msg">
-          if (auto *BI = dyn_cast<BranchInst>(I)) {<br class="gmail_msg">
-            assert(BI->isConditional() && isa<UndefValue>(BI->getCondition()) &&<br class="gmail_msg">
-                   "Branch should be foldable!");<br class="gmail_msg">
-          } else if (auto *SI = dyn_cast<SwitchInst>(I)) {<br class="gmail_msg">
-            assert(isa<UndefValue>(SI->getCondition()) && "Switch should fold");<br class="gmail_msg">
-          } else {<br class="gmail_msg">
-            llvm_unreachable("Didn't fold away reference to block!");<br class="gmail_msg">
-          }<br class="gmail_msg">
-#endif<br class="gmail_msg">
-<br class="gmail_msg">
-          // Make this an uncond branch to the first successor.<br class="gmail_msg">
-          TerminatorInst *TI = I->getParent()->getTerminator();<br class="gmail_msg">
-          BranchInst::Create(TI->getSuccessor(0), TI);<br class="gmail_msg">
-<br class="gmail_msg">
-          // Remove entries in successor phi nodes to remove edges.<br class="gmail_msg">
-          for (unsigned i = 1, e = TI->getNumSuccessors(); i != e; ++i)<br class="gmail_msg">
-            TI->getSuccessor(i)->removePredecessor(TI->getParent());<br class="gmail_msg">
-<br class="gmail_msg">
-          // Remove the old terminator.<br class="gmail_msg">
-          TI->eraseFromParent();<br class="gmail_msg">
-        }<br class="gmail_msg">
+        assert(ConstantFoldTerminator(I->getParent()) &&<br class="gmail_msg">
+          "Terminator should've been folded");<br class="gmail_msg">
       }<br class="gmail_msg">
<br class="gmail_msg">
       // Finally, delete the basic block.<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
llvm-commits mailing list<br class="gmail_msg">
<a href="mailto:llvm-commits@lists.llvm.org" class="gmail_msg" target="_blank">llvm-commits@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br class="gmail_msg">
</blockquote></div>