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

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 30 13:02:38 PDT 2022


ABataev 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);
----------------
Use range-based loop


================
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]));
+
----------------
```
for (Value *V : VL.drop_front())
  OpsForVector.push_back(cast<Instruction>(V));
```
or some magic cast using llvm::copy


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