This is an archive of the discontinued LLVM Phabricator instance.

[mlir][Affine] Fix AffineLoopInvariantCodeMotion
ClosedPublic

Authored by dcaballe on Sep 1 2020, 3:01 PM.

Details

Summary

Make sure that memory ops that are defined inside the loop are registered
as such in 'defineOp'. In the test provided, the 'mulf' op was hoisted
outside the loop nest even when its 'affine.load' operand was not.

Diff Detail

Event Timeline

dcaballe created this revision.Sep 1 2020, 3:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 1 2020, 3:01 PM
dcaballe requested review of this revision.Sep 1 2020, 3:01 PM
bondhugula added inline comments.Sep 1 2020, 7:36 PM
mlir/lib/Dialect/Affine/Transforms/AffineLoopInvariantCodeMotion.cpp
87

The comment is a bit redundant. Either drop or replace it with something that indicates what it means to add it to the definedOps.

mlir/test/Dialect/Affine/affine-loop-invariant-code-motion.mlir
542

This has in general nothing to do with mul specifically, but any side-effect free op consuming the load result?

dcaballe updated this revision to Diff 289500.Sep 2 2020, 9:47 AM
dcaballe marked 2 inline comments as done.

Addressed feedback. Thanks!

bondhugula accepted this revision.Sep 2 2020, 10:31 AM

Thanks!

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

are are -> are

89

which are not -> which are themselves not
?

This revision is now accepted and ready to land.Sep 2 2020, 10:31 AM
This revision was automatically updated to reflect the committed changes.