This is an archive of the discontinued LLVM Phabricator instance.

[Affine][LICM] Mark users of `iter_args` variant
ClosedPublic

Authored by vinayaka-polymage on May 23 2021, 5:45 AM.

Details

Summary

Prevent users of iter_args of an affine for loop from being hoisted
out of it. Otherwise, LICM leads to a violation of the SSA dominance
(as demonstrated in the added test case).

Fixes: https://bugs.llvm.org/show_bug.cgi?id=50103

Diff Detail

Event Timeline

vinayaka-polymage requested review of this revision.May 23 2021, 5:45 AM
bondhugula accepted this revision.May 23 2021, 11:50 PM

LGTM - some minor comments on compactness.

mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp
53

Operation::operand_range aren't normally used on methods/API - just ValueRange should do - more compact/cleaner.

57

Likewise.

138

auto -> Value

138–142

You can use llvm::is_contained to encode this in one line.

140

Nit: terminate with a full stop.

203

auto -> ValueRange should work I think.

This revision is now accepted and ready to land.May 23 2021, 11:50 PM

Thanks for the suggestions for compactness, all of them worked well.

vinayaka-polymage marked 5 inline comments as done.May 24 2021, 3:40 AM

Incorporated all the suggestions, thanks @bondhugula !

mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp
140

Not adding a full stop to be consistent with other places. Sounds good ?

bondhugula accepted this revision.May 24 2021, 4:09 AM

LGTM.

mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp
140

Sounds fine.

ayzhuang accepted this revision.May 24 2021, 9:37 AM

Looks great! Thanks.

This revision was landed with ongoing or failed builds.May 25 2021, 3:27 AM
This revision was automatically updated to reflect the committed changes.