Experimentally we found that promotion to scalars carries less benefits
than sinking and hoisting in LICM. When using MemorySSA, we build an
AliasSetTracker on demand in order to reuse the current infrastructure.
We only build it if less than AccessCapForMSSAPromotion exist in the
loop, a cap that is by default set to 250. This value ensures there are
no runtime regressions, and there are small compile time gains for
pathological cases. A much lower value (20) was found to yield a single
regression in the llvm-test-suite and much higher benefits for compile
times. Conservatively we set the current cap to a high value, but we will
explore lowering it when MemorySSA is enabled by default.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Analysis/AliasSetTracker.cpp | ||
---|---|---|
523 ↗ | (On Diff #183196) | Maybe call this addAllInstructionsInLoopUsingMSSA? A bit long, but more descriptive I think. |
lib/Transforms/Scalar/LICM.cpp | ||
125 ↗ | (On Diff #183196) | Let's make this a bit more descriptive -- how about "When MSSA in LICM is disabled, then this has no effect. When MSSA in LICM is enabled then ...". |
2003 ↗ | (On Diff #183196) | CurAST is never null right? Can we make it a reference (or add an assert in LoopPromoter) and avoid checking it for null in LoopPromoter::replaceLoadWithValue etc.? |
Overall, really nice patch. A bunch of super nit-picky comments below, not much more to add beyond Sanjoy's review honestly. =D With these comments addressed, LGTM, but maybe double check if Sanjoy is happy w/ the update before submitting.
include/llvm/Transforms/Utils/LoopUtils.h | ||
---|---|---|
152–156 ↗ | (On Diff #183636) | Does clang-format only do this after your change? If not, I suspect either a weird configuration issue in your clang-format or it'd be nice to do the clang-format change first to make the diff more obvious here. |
lib/Analysis/AliasSetTracker.cpp | ||
321–323 ↗ | (On Diff #183636) | nit: I would just move these comments to not be trailing comments, use braces, and land that as a NFC commit rather than in this patch. |
526–528 ↗ | (On Diff #183636) | Minor preference for Accesses and Access, makes it easier for me to read. |
lib/Transforms/Scalar/LICM.cpp | ||
120 ↗ | (On Diff #183636) | nit: Add vertical space above. |
316 ↗ | (On Diff #183636) | Same naming comment as above. |
2088 ↗ | (On Diff #183636) | Good place to use auto -- the RHS spells out the type. |
include/llvm/Transforms/Utils/LoopUtils.h | ||
---|---|---|
152–156 ↗ | (On Diff #183636) | AFAICT it's because of adding the additional MemorySSAUpdater * argument. |