From: Peizhao Ou Date: Tue, 5 Dec 2017 01:09:40 +0000 (-0800) Subject: Sets insertion point of fake cond branch to the last phi node in the block X-Git-Url: http://demsky.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=70b36591bc9e9f0772c62794bf1a202b1884aaf6 Sets insertion point of fake cond branch to the last phi node in the block --- diff --git a/lib/CodeGen/CodeGenPrepare.cpp b/lib/CodeGen/CodeGenPrepare.cpp index df49c8d6aae..ac8fbbf9c76 100644 --- a/lib/CodeGen/CodeGenPrepare.cpp +++ b/lib/CodeGen/CodeGenPrepare.cpp @@ -790,6 +790,9 @@ void TaintRelaxedLoads(Instruction* UsageInst) { // condition. auto* BB = UsageInst->getParent(); auto* InsertPoint = UsageInst->getNextNode(); + while (dyn_cast(InsertPoint)) { + InsertPoint = InsertPoint->getNextNode(); + } IRBuilder Builder(InsertPoint); // First thing is to cast 'UsageInst' to an integer type if necessary. Value* AndTarget = nullptr; diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp index c8f99c5b4cc..37b56f8efc7 100644 --- a/lib/IR/Verifier.cpp +++ b/lib/IR/Verifier.cpp @@ -1974,6 +1974,10 @@ void Verifier::visitBasicBlock(BasicBlock &BB) { "PHI nodes must have at least one entry. If the block is dead, " "the PHI should be removed!", PN); + if (PN->getNumIncomingValues() != Preds.size()) { + dbgs() << "Problematic function: \n" << *PN->getParent()->getParent() << "\n"; + dbgs() << "Problematic block: \n" << *PN->getParent() << "\n"; + } Assert(PN->getNumIncomingValues() == Preds.size(), "PHINode should have one entry for each predecessor of its " "parent basic block!",