mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 03:24:09 +00:00
SLPVectorizer: Take credit for free extractelement instructions
Extract element instructions that will be removed when vectorzing lower the cost. Patch by Arch D. Robison! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205020 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1015,8 +1015,17 @@ int BoUpSLP::getEntryCost(TreeEntry *E) {
|
||||
return 0;
|
||||
}
|
||||
case Instruction::ExtractElement: {
|
||||
if (CanReuseExtract(VL))
|
||||
return 0;
|
||||
if (CanReuseExtract(VL)) {
|
||||
int DeadCost = 0;
|
||||
for (unsigned i = 0, e = VL.size(); i < e; ++i) {
|
||||
ExtractElementInst *E = cast<ExtractElementInst>(VL[i]);
|
||||
if (E->hasOneUse())
|
||||
// Take credit for instruction that will become dead.
|
||||
DeadCost +=
|
||||
TTI->getVectorInstrCost(Instruction::ExtractElement, VecTy, i);
|
||||
}
|
||||
return -DeadCost;
|
||||
}
|
||||
return getGatherCost(VecTy);
|
||||
}
|
||||
case Instruction::ZExt:
|
||||
|
Reference in New Issue
Block a user