This is an archive of the discontinued LLVM Phabricator instance.

[mlir] refactor common idiom into AffineMap method
ClosedPublic

Authored by aartbik on Nov 13 2020, 3:04 PM.

Details

Summary

motivated by a refactoring in the new sparse code (yet to be merged), this avoids some lengthy code dup

Diff Detail

Event Timeline

aartbik created this revision.Nov 13 2020, 3:04 PM
aartbik requested review of this revision.Nov 13 2020, 3:04 PM
aartbik edited the summary of this revision. (Show Details)Nov 13 2020, 3:06 PM
aartbik added a reviewer: ftynse.
mehdi_amini accepted this revision.Nov 13 2020, 5:57 PM
mehdi_amini added inline comments.
mlir/include/mlir/IR/AffineMap.h
128

Can you add an API doc?

mlir/lib/IR/AffineMap.cpp
232

You could save the assert with:

getResult(idx).cast<AffineDimExpr>().getPosition();

This revision is now accepted and ready to land.Nov 13 2020, 5:57 PM
aartbik marked 2 inline comments as done.Nov 13 2020, 6:09 PM

Thanks Medhi.

mlir/lib/IR/AffineMap.cpp
232

We could do that for getResult itself to and call the index less one (didn't do that in this CL though)

aartbik updated this revision to Diff 305287.Nov 13 2020, 6:12 PM
aartbik marked an inline comment as done.

addressed comments

This revision was automatically updated to reflect the committed changes.