[PATCH] D28307: Add Instruction number to LSR cost model (PR23384) part 1 of 3

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 24 15:39:06 PST 2017


hfinkel added inline comments.


================
Comment at: lib/Transforms/Scalar/LoopStrengthReduce.cpp:1193
+  // Treat every new register that exceeds TTI.getNumberOfRegisters() - 1 as
+  // additional instruction.
+  unsigned TTIRegNum = TTI.getNumberOfRegisters(false) - 1;
----------------
This represents the spill of the old value, right? We should say so.


================
Comment at: lib/Transforms/Scalar/LoopStrengthReduce.cpp:1231
+
+  if (LU.Kind == LSRUse::ICmpZero && !F.hasZeroEnd())
+    Insns++;
----------------
Please add a comment this explain this (a subtraction for the constant term in the formula?).


================
Comment at: lib/Transforms/Scalar/LoopStrengthReduce.cpp:1233
+    Insns++;
+  // Each new AddRec adds 1 instruction to calculation.
+  Insns += (AddRecCost - PrevAddRecCost);
----------------
This is the instruction that represents the increment?


================
Comment at: lib/Transforms/Scalar/LoopStrengthReduce.cpp:1256
 bool Cost::operator<(const Cost &Other) const {
+  if (InsnsCost && Insns != Other.Insns)
+    return Insns < Other.Insns;
----------------
Do you really want to make this the most-important factor?


Repository:
  rL LLVM

https://reviews.llvm.org/D28307





More information about the llvm-commits mailing list