[PATCH] Cleanup register pressure calculation in MachineLICM

Quentin Colombet qcolombet at apple.com
Mon Mar 30 15:30:49 PDT 2015


================
Comment at: lib/CodeGen/MachineLICM.cpp:894
@@ +893,3 @@
+    else 
+      RegPressure[i] += Cost[i];
+  }
----------------
I believe you meant -=

================
Comment at: lib/CodeGen/MachineLICM.cpp:900
@@ +899,3 @@
+                                                  bool ConsiderSeen) {
+  SmallVector<int, 8> Cost(TRI->getNumRegClasses(), 0);
+  if (MI->isImplicitDef())
----------------
I believe taking a DenseMap as argument would be more appropriate.

The small vector is usually not small (about 80 reg classes on X86 and 50 reg classes on AArch for instance IIRC).

================
Comment at: lib/CodeGen/MachineLICM.cpp:1118
@@ -1127,3 +1117,3 @@
 /// register pressure.
-bool MachineLICM::CanCauseHighRegPressure(DenseMap<unsigned, int> &Cost,
+bool MachineLICM::CanCauseHighRegPressure(const SmallVectorImpl<int>& Cost,
                                           bool CheapInstr) {
----------------
Keep the DenseMap signature here.

http://reviews.llvm.org/D8604

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list