If MemorySSA is avaiable, we can skip checking all instructions if block has any Defs.
(volatile loads are also Defs).
We still need to check all instructions for "canThrow", even if no Defs are found.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Transforms/Scalar/SimpleLoopUnswitch.cpp | ||
---|---|---|
852 ↗ | (On Diff #183217) | Do atomic ops fall in the same "we care and should exit now" bucket as volatile loads for this? MSSA uses MemoryDefs to represent fences and atomic loads with ordering > unordered. |
Comment Actions
LGTM (provided I've not missed anything below w.r.t. atomics).
lib/Transforms/Scalar/SimpleLoopUnswitch.cpp | ||
---|---|---|
852 ↗ | (On Diff #183217) | I think so yes, and so I think this code is correct? Such loads "appear" to write to memory and thus I think should bail. At least, this code seems to be remain a good early exit. We still directly test every instruction below. |
Comment Actions
Thank you for the review!
lib/Transforms/Scalar/SimpleLoopUnswitch.cpp | ||
---|---|---|
852 ↗ | (On Diff #183217) | The check below is mayHaveSideEffects, which internally calls mayWriteToMemory, which returns true for fences and unordered loads. |