Currently, the ARM Constant Island may not converge (or not converge quickly).
This patch let it move to the closest water after the user if it doesn't converge after 15 iterations.
This address https://llvm.org/bugs/show_bug.cgi?id=25339
Differential D16890
Fix PR25339: ARM Constant Island weimingz on Feb 4 2016, 10:29 AM. Authored by
Details Currently, the ARM Constant Island may not converge (or not converge quickly). This address https://llvm.org/bugs/show_bug.cgi?id=25339
Diff Detail
Event TimelineComment Actions 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. cheers,
Comment Actions Hi Renato, I'll post the test case shortly. Since it's based on proprietary code, The number 15 is half of the max threshold of 30. Thanks, Comment Actions I completely understand. No worries.
Ah, excellent! That bug was on my radar, and I'm glad someone is looking at it. When you submit a review based on a bug, it's good to put the bug number like "Addresses bug #NNNN", so we can grab the rest of the context.
Right. If the max is hard-coded, then maybe say max/2 in there? It's also not clear to me why 15 is better than 30. If the algorithm fails to converge on both, than clearly either hard-coded numbers would be ok as long as the safe option is implemented. This patch seems to be doing both: forcing a convergence, even if a bad one (which would also work with 30 iterations, I think), and reducing the threshold to 15 (which doesn't make much sense per se).
This means that the application itself is problematic in that respect, so any number beyond 5 would be a good bet, with higher numbers better because they would only hit the worse cases. What's the impact if you keep the original threshold? cheers, Comment Actions Hi Renato, I uploaded the test case to bugzilla. This patch doesn't reduce the threshold to 15. It tries to accelerate Thanks, Comment Actions Ok, so then we need the number 15 to be on the same place as the number 30. If both are magic constants, we need to make them into some kind of static const global or a hidden compiler flag. cheers, Comment Actions I uploaded another test case to https://llvm.org/bugs/show_bug.cgi?id=25339. Comment Actions Looks much better, thanks! There's only the typo on the comment "lowerest" -> "lowest", but LGTM with that fix. This comment was removed by weimingz. |
Shouldn't this 15 be in a constant somewhere? Maybe a hidden command line options, which defaults to 15, but can be changed?