[PATCH] D16890: Fix PR25339: ARM Constant Island

Renato Golin via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 5 05:00:27 PST 2016

rengolin added a comment.

Hi Weiming,

I'd like to know how you got to the magic number of 15. So, showing a small program that doesn't converge, then showing that this change makes it at least stop and produce whatever result is acceptable.

Constant islands are a major pain to get right because some relocations are only handled later and merging two islands can grow the distance of a third beyond the range of some load far away. In the same way, *not* merging could cause the same effects.

Would be good to see the results of compiling large pieces of code (say, LNT, Chromium, Firefox) which have plenty of opportunities to get this wrong. Without tests, it's hard to see what kind of problem you're trying to avoid, here.


Comment at: lib/Target/ARM/ARMConstantIslandPass.cpp:459
@@ -458,3 +458,3 @@
     for (unsigned i = 0, e = CPUsers.size(); i != e; ++i)
-      CPChange |= handleConstantPoolUser(i);
+      CPChange |= handleConstantPoolUser(i, NoCPIters >= 15 /*Ignore Growth*/);
     if (CPChange && ++NoCPIters > 30)
Shouldn't this 15 be in a constant somewhere? Maybe a hidden command line options, which defaults to 15, but can be changed?

Comment at: lib/Target/ARM/ARMConstantIslandPass.cpp:1313
@@ -1311,1 +1312,3 @@
     // we don't insert more branches than necessary.
+    // When IgnoreGrowth is true, we try to find the lowerest address after (or
+    // equal to) user MI's BB no matter of padding growth.

Comment at: lib/Target/ARM/ARMConstantIslandPass.cpp:1327
@@ -1323,1 +1326,3 @@
+        return true;
       // Keep looking unless it is perfect.
+      if (!IgnoreGrowth && BestGrowth == 0)
Update the comment to reflect the new flag



More information about the llvm-commits mailing list