[llvm] r254463 - Fix a bug in IfConversion.cpp.

Cong Hou via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 1 13:50:20 PST 2015


Author: conghou
Date: Tue Dec  1 15:50:20 2015
New Revision: 254463

URL: http://llvm.org/viewvc/llvm-project?rev=254463&view=rev
Log:
Fix a bug in IfConversion.cpp.

The bug is introduced in r254377 which failed some tests on ARM, where a new
probability is assigned to a successor but the provided BB may not be a
successor.


Modified:
    llvm/trunk/lib/CodeGen/IfConversion.cpp

Modified: llvm/trunk/lib/CodeGen/IfConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/IfConversion.cpp?rev=254463&r1=254462&r2=254463&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/IfConversion.cpp (original)
+++ llvm/trunk/lib/CodeGen/IfConversion.cpp Tue Dec  1 15:50:20 2015
@@ -1254,9 +1254,8 @@ bool IfConverter::IfConvertTriangle(BBIn
     auto NewNext = BBNext + BBCvt * CvtNext;
     auto NewTrueBBIter =
         std::find(BBI.BB->succ_begin(), BBI.BB->succ_end(), NewTrueBB);
-    assert(NewTrueBBIter != BBI.BB->succ_end() &&
-           "NewTrueBB is not a successor of BBI.BB.");
-    BBI.BB->setSuccProbability(NewTrueBBIter, NewNext);
+    if (NewTrueBBIter != BBI.BB->succ_end())
+      BBI.BB->setSuccProbability(NewTrueBBIter, NewNext);
 
     auto NewFalse = BBCvt * CvtFalse;
     TII->InsertBranch(*BBI.BB, CvtBBI->FalseBB, nullptr, RevCond, dl);




More information about the llvm-commits mailing list