mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-12 01:25:10 +00:00
PR18060 - When we RAUW values with ExtractElement instructions in some cases
we generate PHI nodes with multiple entries from the same basic block but with different values. Enabling CSE on ExtractElement instructions make sure that all of the RAUWed instructions are the same. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@195773 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1591,6 +1591,8 @@ Value *BoUpSLP::vectorizeTree() {
|
||||
if (PHINode *PN = dyn_cast<PHINode>(Vec)) {
|
||||
Builder.SetInsertPoint(PN->getParent()->getFirstInsertionPt());
|
||||
Value *Ex = Builder.CreateExtractElement(Vec, Lane);
|
||||
if (Instruction *Ins = dyn_cast<Instruction>(Ex))
|
||||
GatherSeq.insert(Ins);
|
||||
User->replaceUsesOfWith(Scalar, Ex);
|
||||
} else if (isa<Instruction>(Vec)){
|
||||
if (PHINode *PH = dyn_cast<PHINode>(User)) {
|
||||
@@ -1598,17 +1600,23 @@ Value *BoUpSLP::vectorizeTree() {
|
||||
if (PH->getIncomingValue(i) == Scalar) {
|
||||
Builder.SetInsertPoint(PH->getIncomingBlock(i)->getTerminator());
|
||||
Value *Ex = Builder.CreateExtractElement(Vec, Lane);
|
||||
if (Instruction *Ins = dyn_cast<Instruction>(Ex))
|
||||
GatherSeq.insert(Ins);
|
||||
PH->setOperand(i, Ex);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Builder.SetInsertPoint(cast<Instruction>(User));
|
||||
Value *Ex = Builder.CreateExtractElement(Vec, Lane);
|
||||
if (Instruction *Ins = dyn_cast<Instruction>(Ex))
|
||||
GatherSeq.insert(Ins);
|
||||
User->replaceUsesOfWith(Scalar, Ex);
|
||||
}
|
||||
} else {
|
||||
Builder.SetInsertPoint(F->getEntryBlock().begin());
|
||||
Value *Ex = Builder.CreateExtractElement(Vec, Lane);
|
||||
if (Instruction *Ins = dyn_cast<Instruction>(Ex))
|
||||
GatherSeq.insert(Ins);
|
||||
User->replaceUsesOfWith(Scalar, Ex);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user