From: Cong Hou Date: Tue, 1 Dec 2015 21:50:20 +0000 (+0000) Subject: Fix a bug in IfConversion.cpp. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=d715c5a2cfd096fc5ac18e81a4b7cdfc55cc4f0f 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254463 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/IfConversion.cpp b/lib/CodeGen/IfConversion.cpp index ff28f95cc33..e90cb02bd28 100644 --- a/lib/CodeGen/IfConversion.cpp +++ b/lib/CodeGen/IfConversion.cpp @@ -1254,9 +1254,8 @@ bool IfConverter::IfConvertTriangle(BBInfo &BBI, IfcvtKind Kind) { 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);