[PATCH] Cleanup register pressure calculation in MachineLICM

Quentin Colombet qcolombet at apple.com
Wed Apr 1 13:35:27 PDT 2015


================
Comment at: lib/CodeGen/MachineLICM.cpp:902
@@ +901,3 @@
+                                                      bool ConsiderSeen) {
+  DenseMap<unsigned, int> Cost;
+  if (MI->isImplicitDef())
----------------
I would prefer a reference on the DenseMap.
Copying it around may not be efficient.

================
Comment at: lib/CodeGen/MachineLICM.cpp:1120
@@ -1127,3 +1119,3 @@
 /// register pressure.
-bool MachineLICM::CanCauseHighRegPressure(DenseMap<unsigned, int> &Cost,
+bool MachineLICM::CanCauseHighRegPressure(const DenseMap<unsigned, int>& Cost,
                                           bool CheapInstr) {
----------------
This part of the patch is unrelated to this change (i.e., constify + for-range).
Please commit that separately.

================
Comment at: lib/CodeGen/MachineLICM.cpp:894
@@ +893,3 @@
+    else 
+      RegPressure[i] += Cost[i];
+  }
----------------
djasper wrote:
> qcolombet wrote:
> > I believe you meant -=
> Yes, thanks for catching.. I am a little frightened that this didn't break a single test ..
Could you try a llvm test-suite run to see if anything changes and if yes, extract a small test-case to add in this commit.

http://reviews.llvm.org/D8604

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






More information about the llvm-commits mailing list