mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
(Almost) always call reserveOperandSpace() on newly created PHINodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128535 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1598,13 +1598,15 @@ static bool SimplifyCondBranchToCondBranch(BranchInst *PBI, BranchInst *BI) {
|
||||
// in the constant and simplify the block result. Subsequent passes of
|
||||
// simplifycfg will thread the block.
|
||||
if (BlockIsSimpleEnoughToThreadThrough(BB)) {
|
||||
pred_iterator PB = pred_begin(BB), PE = pred_end(BB);
|
||||
PHINode *NewPN = PHINode::Create(Type::getInt1Ty(BB->getContext()),
|
||||
BI->getCondition()->getName() + ".pr",
|
||||
BB->begin());
|
||||
NewPN->reserveOperandSpace(std::distance(PB, PE));
|
||||
// Okay, we're going to insert the PHI node. Since PBI is not the only
|
||||
// predecessor, compute the PHI'd conditional value for all of the preds.
|
||||
// Any predecessor where the condition is not computable we keep symbolic.
|
||||
for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI) {
|
||||
for (pred_iterator PI = PB; PI != PE; ++PI) {
|
||||
BasicBlock *P = *PI;
|
||||
if ((PBI = dyn_cast<BranchInst>(P->getTerminator())) &&
|
||||
PBI != BI && PBI->isConditional() &&
|
||||
|
Reference in New Issue
Block a user