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

Evgeny Stupachenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 24 16:19:27 PST 2017


evstupac 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;
----------------
hfinkel wrote:
> This represents the spill of the old value, right? We should say so.
To be exact at least 1 fill.
Ideally RA should start with fills. 


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


================
Comment at: lib/Transforms/Scalar/LoopStrengthReduce.cpp:1256
 bool Cost::operator<(const Cost &Other) const {
+  if (InsnsCost && Insns != Other.Insns)
+    return Insns < Other.Insns;
----------------
hfinkel wrote:
> Do you really want to make this the most-important factor?
Yes. What is more important than instruction count on this stage?


Repository:
  rL LLVM

https://reviews.llvm.org/D28307





More information about the llvm-commits mailing list