[PATCH] D29004: New OptimizationRemarkEmitter pass for MIR

Adam Nemet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 25 14:15:53 PST 2017


anemet marked 3 inline comments as done.
anemet added inline comments.


================
Comment at: lib/CodeGen/MachineOptimizationRemarkEmitter.cpp:34-35
+    DiagnosticInfoMIROptimization &Remark) {
+  const MachineBasicBlock *MBB = Remark.getBlock();
+  if (MBB)
+    Remark.setHotness(computeHotness(MBB));
----------------
MatzeB wrote:
> Could move the declaration into the if
No, they control-dependent :)


================
Comment at: lib/CodeGen/RegAllocGreedy.cpp:430
+                                    unsigned &FoldedSpills);
+
+  /// Report the number of spills and reloads for each loop.
----------------
MatzeB wrote:
> Would it make sense to add a `if (!OptimizationRemark::isEnabled(DEBUG_TYPE)) return;` here?
No, -fsave-optimization-record should get this regardless of Enabled.  Filtering is on the consumer side.


================
Comment at: lib/CodeGen/RegAllocGreedy.cpp:438
+
+    for (MachineLoop *L : *Loops)
+      reportNumberOfSplillsReloads(L, Reloads, FoldedReloads, Spills,
----------------
MatzeB wrote:
> Shouldn't this do `Reloads = 0; FoldedReloads = 0; ...` in each loop iteration as we shouldn't add the values of an earlier loop to a later loop (we just want it from inner loops to outer loops I assume).
What?! You can't count for a single loop and for all contained loops in the same variable?!  Thanks for noticing!

Also extended the test to cover for this.


https://reviews.llvm.org/D29004





More information about the llvm-commits mailing list