This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] Add OrOp folding rule for constant one operand
ClosedPublic

Authored by bondhugula on Oct 5 2021, 10:28 PM.

Details

Summary

Add folding rule for std.or op when an operand has all bits set.

or(x, <all bits set>) -> <all bits set>

Diff Detail

Event Timeline

bondhugula created this revision.Oct 5 2021, 10:28 PM
bondhugula requested review of this revision.Oct 5 2021, 10:28 PM
rriddle added inline comments.Oct 5 2021, 10:32 PM
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
1566–1568

OrOp is a bitwise or, this doesn't look correct for non-i1. Is this intended to capture when all bits are set in one of the values?

Fix folder for all ones.

mlir/lib/Dialect/StandardOps/IR/Ops.cpp
1566–1568

Oops, I missed that; thanks. I actually meant to capture the i1 case but I've now changed this to fold for "all bits set" case.

Update comment.

Use CHECK-DAG for constants.

bondhugula edited the summary of this revision. (Show Details)

Update commit summary.

Gentle ping to reviewers @rriddle @mehdi_amini @herhut on this trivial revision.

bondhugula retitled this revision from Add OrOp folding rule for constant one operand to [MLIR] Add OrOp folding rule for constant one operand.Oct 6 2021, 7:17 PM
rriddle accepted this revision.Oct 6 2021, 7:26 PM

LG, thanks.

This revision is now accepted and ready to land.Oct 6 2021, 7:26 PM
bondhugula marked an inline comment as done.Oct 6 2021, 7:32 PM
This revision was automatically updated to reflect the committed changes.