Merge pull request #16455 from mppf/fix-unordered-opt-ra-atomics
Do not check for order independence in forall-unordered opt
See #12150 for previous discussion of the forall-unordered-opt and its legality.
The forall-unordered opt already only applies to forall loops. This PR
removes an additional check that the loop being optimized (after lowering
iterators) was order independent.
The forall-unordered opt already only applies to forall loops because
the optimization legality checks before iterator lowering (where
lifetimes are checked) only add the OptInfo to forall loops. The later
part of the pass which runs after iterator inlining will only optimize
last statements that are followed by an OptInfo.
As a result, it does not need to check that the forall loop only
contained order-independent code. If the last statement came from a
follower loop, that last statement won’t be marked with OptInfo (because
it wasn’t present in the forall loop before iterator inlining) and the
optimization will fail. If the last statement came from the original
forall loop then the order-independent-ness of the iterator follower
loops is irrelevant - since the author of the original forall loop
indicated it was order independent and the code being delayed is from
Adds some tests of patterns along these lines to verify that they are
optimized (or not) as expected.
Reviewed by @ronawho - thanks!
- [x] full futures local testing