<div dir="ltr">It looks like this is breaking several tests, and may be the cause of https://llvm.org/bugs/show_bug.cgi?id=31271.<div><br></div><div>I see these failures starting with this commit:</div><div><br></div><div><div>Failing Tests (10):</div><div>    LLVM :: Transforms/IPConstantProp/fp-bc-icmp-const-fold.ll</div><div>    LLVM :: Transforms/IPConstantProp/global.ll</div><div>    LLVM :: Transforms/IPConstantProp/user-with-multiple-uses.ll</div><div>    LLVM :: Transforms/SCCP/apint-ipsccp1.ll</div><div>    LLVM :: Transforms/SCCP/apint-ipsccp2.ll</div><div>    LLVM :: Transforms/SCCP/apint-ipsccp3.ll</div><div>    LLVM :: Transforms/SCCP/apint-ipsccp4.ll</div><div>    LLVM :: Transforms/SCCP/atomic-load-store.ll</div><div>    LLVM :: Transforms/SCCP/ipsccp-basic.ll</div><div>    LLVM :: Transforms/SCCP/switch-multiple-undef.ll</div><div><br></div><div><br></div><div>Do you have a fix in mind? If not, could you try rolling back the change?</div><div><br></div><br>On Monday, December 5, 2016 at 3:14:34 PM UTC-8, Davide Italiano via llvm-commits wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">Author: davide<br>Date: Mon Dec  5 17:04:21 2016<br>New Revision: 288725<p>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=288725&view=rev" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Fllvm.org%2Fviewvc%2Fllvm-project%3Frev%3D288725%26view%3Drev\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE15eMRLAPpWJIa0C5eMvT4JweYCw';return true;" onclick="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Fllvm.org%2Fviewvc%2Fllvm-project%3Frev%3D288725%26view%3Drev\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE15eMRLAPpWJIa0C5eMvT4JweYCw';return true;" class="cremed">http://llvm.org/viewvc/llvm-<wbr>project?rev=288725&view=rev</a><br>Log:<br>[SCCP] Remove manual folding of terminator instructions.</p><p>There are two cases handled here:<br>1) a branch on undef<br>2) a switch with an undef condition.</p><p>Both cases are currently handled by ResolvedUndefsIn. If we have<br>a branch on undef, we force its value to false (which is trivially<br>foldable). If we have a switch on undef, we force to the first<br>constant (which is also foldable).</p><p>Modified:<br>    llvm/trunk/lib/Transforms/<wbr>Scalar/SCCP.cpp</p><p>Modified: llvm/trunk/lib/Transforms/<wbr>Scalar/SCCP.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SCCP.cpp?rev=288725&r1=288724&r2=288725&view=diff" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Fllvm.org%2Fviewvc%2Fllvm-project%2Fllvm%2Ftrunk%2Flib%2FTransforms%2FScalar%2FSCCP.cpp%3Frev%3D288725%26r1%3D288724%26r2%3D288725%26view%3Ddiff\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHJqkePerqQRlU50uQvLr6lz-M9LQ';return true;" onclick="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Fllvm.org%2Fviewvc%2Fllvm-project%2Fllvm%2Ftrunk%2Flib%2FTransforms%2FScalar%2FSCCP.cpp%3Frev%3D288725%26r1%3D288724%26r2%3D288725%26view%3Ddiff\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHJqkePerqQRlU50uQvLr6lz-M9LQ';return true;" class="cremed">http://llvm.org/viewvc/llvm-<wbr>project/llvm/trunk/lib/<wbr>Transforms/Scalar/SCCP.cpp?<wbr>rev=288725&r1=288724&r2=<wbr>288725&view=diff</a><br>==============================<wbr>==============================<wbr>==================<br>--- llvm/trunk/lib/Transforms/<wbr>Scalar/SCCP.cpp (original)<br>+++ llvm/trunk/lib/Transforms/<wbr>Scalar/SCCP.cpp Mon Dec  5 17:04:21 2016<br>@@ -1828,33 +1828,8 @@ static bool runIPSCCP(Module &M, const D<br>         // Ignore blockaddress users; BasicBlock's dtor will handle them.<br>         if (!I) continue;<br> <br>-        bool Folded = ConstantFoldTerminator(I-><wbr>getParent());<br>-        if (!Folded) {<br>-          // The constant folder may not have been able to fold the terminator<br>-          // if this is a branch or switch on undef.  Fold it manually as a<br>-          // branch to the first successor.<br>-#ifndef NDEBUG<br>-          if (auto *BI = dyn_cast<BranchInst>(I)) {<br>-            assert(BI->isConditional() && isa<UndefValue>(BI-><wbr>getCondition()) &&<br>-                   "Branch should be foldable!");<br>-          } else if (auto *SI = dyn_cast<SwitchInst>(I)) {<br>-            assert(isa<UndefValue>(SI-><wbr>getCondition()) && "Switch should fold");<br>-          } else {<br>-            llvm_unreachable("Didn't fold away reference to block!");<br>-          }<br>-#endif<br>-<br>-          // Make this an uncond branch to the first successor.<br>-          TerminatorInst *TI = I->getParent()->getTerminator(<wbr>);<br>-          BranchInst::Create(TI-><wbr>getSuccessor(0), TI);<br>-<br>-          // Remove entries in successor phi nodes to remove edges.<br>-          for (unsigned i = 1, e = TI->getNumSuccessors(); i != e; ++i)<br>-            TI->getSuccessor(i)-><wbr>removePredecessor(TI-><wbr>getParent());<br>-<br>-          // Remove the old terminator.<br>-          TI->eraseFromParent();<br>-        }<br>+        assert(<wbr>ConstantFoldTerminator(I-><wbr>getParent()) &&<br>+          "Terminator should've been folded");<br>       }<br> <br>       // Finally, delete the basic block.</p><p><br>______________________________<wbr>_________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@lists.llvm.org" target="_blank" rel="nofollow" onmousedown="this.href='mailto:llvm-commits@lists.llvm.org';return true;" onclick="this.href='mailto:llvm-commits@lists.llvm.org';return true;" class="cremed">llvm-commits@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Flists.llvm.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fllvm-commits\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFQx5it08j_9kXyPppBMYrkOwlE2A';return true;" onclick="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Flists.llvm.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fllvm-commits\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFQx5it08j_9kXyPppBMYrkOwlE2A';return true;" class="cremed">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br></p><p></p><p></p><p></p><p></p><p></p></blockquote></div></div>