[llvm] [SLPVectorizer][X86] Free load cost for stores with constant pointers (PR #118016)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 2 09:11:29 PST 2024
================
@@ -5157,8 +5157,9 @@ InstructionCost X86TTIImpl::getMemoryOpCost(unsigned Opcode, Type *Src,
InstructionCost Cost = 0;
- // Add a cost for constant load to vector.
- if (Opcode == Instruction::Store && OpInfo.isConstant())
+ // Add a cost for constant load to vector, if pointer is not a constant.
+ if (auto *SI = dyn_cast_or_null<StoreInst>(I);
+ SI && !isa<Constant>(SI->getPointerOperand()) && OpInfo.isConstant())
----------------
RKSimon wrote:
Looking at #111126 - shouldn't we be checking to see if `OpInfo.isUniform()` and adjusting the Type accordingly?
It looks like the test case thinks it has to load a `<20 x i64> splat(i64 1)` constant when it just has to load `<2 x i64> splat(i64 1)`
https://github.com/llvm/llvm-project/pull/118016
More information about the llvm-commits
mailing list