mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Fix PR16797 - Support PHINodes with multiple inputs from the same basic block.
Do not generate new vector values for the same entries because we know that the incoming values from the same block must be identical. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188185 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1187,10 +1187,21 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) {
|
||||
PHINode *NewPhi = Builder.CreatePHI(VecTy, PH->getNumIncomingValues());
|
||||
E->VectorizedValue = NewPhi;
|
||||
|
||||
// PHINodes may have multiple entries from the same block. We want to
|
||||
// visit every block once.
|
||||
SmallSet<BasicBlock*, 4> VisitedBBs;
|
||||
|
||||
for (unsigned i = 0, e = PH->getNumIncomingValues(); i < e; ++i) {
|
||||
ValueList Operands;
|
||||
BasicBlock *IBB = PH->getIncomingBlock(i);
|
||||
|
||||
if (VisitedBBs.count(IBB)) {
|
||||
NewPhi->addIncoming(NewPhi->getIncomingValueForBlock(IBB), IBB);
|
||||
continue;
|
||||
}
|
||||
|
||||
VisitedBBs.insert(IBB);
|
||||
|
||||
// Prepare the operand vector.
|
||||
for (unsigned j = 0; j < E->Scalars.size(); ++j)
|
||||
Operands.push_back(cast<PHINode>(E->Scalars[j])->
|
||||
|
Reference in New Issue
Block a user