[PATCH] D132967: [SLP] Pass full scalar and vector context instructions to TTI.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 31 08:40:08 PDT 2022


fhahn marked 2 inline comments as done.
fhahn added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6438-6441
+      for (unsigned i = 0, e = VL.size(); i < e; ++i)
+        ScalarCost += TTI->getArithmeticInstrCost(
+            E->getOpcode(), ScalarTy, CostKind, Op1Info, Op2Info, Operands,
+            isa<Instruction>(VL[i]) ? cast<Instruction>(VL[i]) : nullptr);
----------------
ABataev wrote:
> Use range-based loop
Thanks should be fixed!


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6459-6460
+      SmallVector<const Instruction *> OpsForVector = {VL0};
+      for (unsigned I = 1; I != VL.size(); ++I)
+        OpsForVector.push_back(cast<Instruction>(VL[I]));
+
----------------
ABataev wrote:
> ```
> for (Value *V : VL.drop_front())
>   OpsForVector.push_back(cast<Instruction>(V));
> ```
> or some magic cast using llvm::copy
Thanks, updated to a range-based for loop.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132967/new/

https://reviews.llvm.org/D132967



More information about the llvm-commits mailing list