[PATCH] D110623: [SLP] Avoid calculating expensive spill cost when it is not required

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 6 08:46:08 PST 2021


ABataev added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:5528-5535
+  bool NoCallInst = true;
+  for (auto &BSIter : BlocksSchedules) {
+    BlockScheduling *BS = BSIter.second.get();
+    if (!BS->NoCalls) {
+      NoCallInst = false;
+      break;
+    }
----------------
Hmm, you're using `NoCalls` here but it is always `false`. Currently `NoCallInst` is always false.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:5538
+  InstructionCost SpillCost = NoCallInst ? 0 : getSpillCost();
+  assert(NoCallInst ? getSpillCost() == 0 : true && "Incorrect spill cost");
   Cost += SpillCost + ExtractCost;
----------------
Better to make it `(!NoCallInst || getSpillCost() == 0) && ...`.


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

https://reviews.llvm.org/D110623



More information about the llvm-commits mailing list