[llvm] [SLP]Initial support for interleaved loads (PR #112042)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 11 15:31:45 PDT 2024


================
@@ -10968,10 +11057,15 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
     auto *LI0 = cast<LoadInst>(VL0);
     auto GetVectorCost = [&](InstructionCost CommonCost) {
       InstructionCost VecLdCost;
-      if (E->State == TreeEntry::Vectorize) {
+      if (E->State == TreeEntry::Vectorize && !E->getInterleaveFactor()) {
         VecLdCost = TTI->getMemoryOpCost(
             Instruction::Load, VecTy, LI0->getAlign(),
             LI0->getPointerAddressSpace(), CostKind, TTI::OperandValueInfo());
+      } else if (std::optional<unsigned> Factor = E->getInterleaveFactor();
----------------
preames wrote:

I think this would be easy to read as:
if (E->State == TreeEntry::Vectorize) {
  if (std::optional<unsigned> Factor = E->getInterleaveFactor()) { do interleave cost }
  else { do normal costing; }
}

https://github.com/llvm/llvm-project/pull/112042


More information about the llvm-commits mailing list