X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=lib%2FCodeGen%2FIfConversion.cpp;h=71bd61a15cb763541f41b745aeb02c73c07a2604;hp=ff28f95cc33de8b4b682744f1fb5a69c5386412b;hb=dd635a682c991ecf3b61b86e8caceb842d2e8667;hpb=92989cbe8452a9406f6e0d3c5709b5745f27158a diff --git a/lib/CodeGen/IfConversion.cpp b/lib/CodeGen/IfConversion.cpp index ff28f95cc33..71bd61a15cb 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); @@ -1680,15 +1679,6 @@ void IfConverter::MergeBlocks(BBInfo &ToBBI, BBInfo &FromBBI, bool AddEdges) { BranchProbability::getZero()); } - if (AddEdges && ToBBI.BB->isSuccessor(FromBBI.BB)) { - // Set the edge probability from ToBBI.BB to FromBBI.BB to zero to avoid the - // edge probability being merged to other edges when this edge is removed - // later. - ToBBI.BB->setSuccProbability( - std::find(ToBBI.BB->succ_begin(), ToBBI.BB->succ_end(), FromBBI.BB), - BranchProbability::getZero()); - } - for (unsigned i = 0, e = FromSuccs.size(); i != e; ++i) { MachineBasicBlock *Succ = FromSuccs[i]; // Fallthrough edge can't be transferred.