Before this patch, if any Use existed in the loop, with a defining
access in the loop, we conservatively decide to not move the store.
What this approach was missing, is that ordered loads are not Uses, they're Defs
in MemorySSA. So, even when the clobbering walker does not find that
volatile load to interfere, we still cannot hoist a store past a
volatile load.
Resolves PR41140.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
Thanks for this!
lib/Transforms/Scalar/LICM.cpp | ||
---|---|---|
1196 ↗ | (On Diff #191397) | Is this bit relevant to PR41140? If not, please commit separately. |
1213 ↗ | (On Diff #191397) | nit: please fold the if into this, e.g. else if (const auto *MD = dyn_cast<MemoryDef>(&MA)) |
1215 ↗ | (On Diff #191397) | please clang-format |
1216 ↗ | (On Diff #191397) | Should this be an assertion? Loads are only Defs if they're volatile or have >= some strength of atomic ordering |
1224 ↗ | (On Diff #191397) | nit: please fold this into the return: return MSSA->isLiveOnEntryDef(Source) || !CurLoop->contains(...); |
lib/Transforms/Scalar/LICM.cpp | ||
---|---|---|
1196 ↗ | (On Diff #191397) | This was in the previous code, and it's needed. I just refactored the code a bit, and moved this check before calling getClobbering to get an early exit. |