This is an archive of the discontinued LLVM Phabricator instance.

[mlir][index] Add folders for `index` ops
ClosedPublic

Authored by Mogball on Oct 11 2022, 9:47 AM.

Details

Summary

This patch adds folders for index dialect ops. Ths folders are
careful to ensure that fold results are valid on both 32-bit and 64-bit
targets.

Depends on D135689

Diff Detail

Event Timeline

Mogball created this revision.Oct 11 2022, 9:47 AM
Herald added a project: Restricted Project. · View Herald Transcript
Mogball requested review of this revision.Oct 11 2022, 9:47 AM
bondhugula added a subscriber: bondhugula.
bondhugula added inline comments.
mlir/lib/Dialect/Index/IR/IndexOps.cpp
44

You can simply use:

b.create<ConstantIndexOp>(loc, indexValue);

since type is guaranteed to be index here.

Mogball marked an inline comment as done.Oct 12 2022, 7:29 AM
Mogball added inline comments.
mlir/lib/Dialect/Index/IR/IndexOps.cpp
44

This is not arith::ConstantOp. It is index::ConstantOp.

bondhugula added inline comments.Oct 12 2022, 10:16 AM
mlir/lib/Dialect/Index/IR/IndexOps.cpp
44

I see. Why do you need to pass it a type argument?

Mogball marked 2 inline comments as done.Oct 14 2022, 9:33 AM
Mogball added inline comments.
mlir/lib/Dialect/Index/IR/IndexOps.cpp
44

I do not. Good catch

Mogball updated this revision to Diff 467806.Oct 14 2022, 9:36 AM
Mogball marked an inline comment as done.

review comment

rriddle accepted this revision.Oct 20 2022, 6:11 PM
This revision is now accepted and ready to land.Oct 20 2022, 6:11 PM
This revision was automatically updated to reflect the committed changes.