Canonicalize/fold SExt and IndexCast
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Please expand the commit summary to a line or two at least. It really doesn't summarize the canonicalization part.
mlir/lib/Dialect/StandardOps/IR/Ops.cpp | ||
---|---|---|
1245 | Missing doc comment. | |
1471–1472 | Please use dyn_cast - will lead to one check less with assertions enabled and more compact. | |
2731–2732 | Likewise. | |
mlir/test/Dialect/Standard/canonicalize.mlir | ||
406–410 | This looks wrong to me. You don't get the same bits in index without doing the sign extension? | |
431 | Missing new line at end of file. |
The commit message has been revised to the following (though apparently not updating on Phabricator summary):
Author: William S. Moses <gh@wsmoses.com> Date: Sun May 2 00:39:45 2021 -0400 [MLIR] Canonicalization of Integer Cast Operations 1) Canonicalize IndexCast(SExt(x)) => IndexCast(x) 2) Provide constant folds of sign_extend and truncate Differential Revision: https://reviews.llvm.org/D101714
mlir/test/Dialect/Standard/canonicalize.mlir | ||
---|---|---|
406–410 | From my reading of the lang ref (https://mlir.llvm.org/docs/Dialects/Standard/#stdindex_cast-indexcastop), this should be correct. Namely, index_cast is itself defined to be a sign extension so it is fine to fold the other extension into it. |
The phab summary will have to be updated manually.
mlir/test/Dialect/Standard/canonicalize.mlir | ||
---|---|---|
406–410 | You are right! |
Missing doc comment.