[PATCH] D41278: [MachineCombiner] Improve debug output (NFC)

Gerolf Hoflehner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 2 02:22:52 PST 2018


Gerolf added inline comments.


================
Comment at: lib/CodeGen/MachineCombiner.cpp:432
   DEBUG(dbgs() << "Combining MBB " << MBB->getName() << "\n");
-
+#ifndef NDEBUG
+  const TargetSubtargetInfo &STI = MF->getSubtarget();
----------------
+ 1 

Also, why recompute STI?


================
Comment at: lib/CodeGen/MachineCombiner.cpp:478
 
+    DEBUG(dbgs() << " Possible instr(s) to replace\n");
+    DEBUG(dbgs() << "\t" << STI.getSchedInfoStr(MI) << ": ";
----------------
Duplicate info to what is displayed in the loops below?


================
Comment at: lib/CodeGen/MachineCombiner.cpp:496
 
+      DEBUG(dbgs() << "\tThese instructions could be removed\n");
+      for (auto const *InstrPtr : DelInstrs) {
----------------
The loops should be wrapped in DEBUG. Since this is a lot of info that is potentially logged I suggest to offer an option to enable this dump.


================
Comment at: lib/CodeGen/MachineCombiner.cpp:567
 
-bool MachineCombiner::runOnMachineFunction(MachineFunction &MF) {
-  const TargetSubtargetInfo &STI = MF.getSubtarget();
+bool MachineCombiner::runOnMachineFunction(MachineFunction &_MF) {
+  MF = &_MF;
----------------
What motivates the changes in this function?


https://reviews.llvm.org/D41278





More information about the llvm-commits mailing list