Page MenuHomePhabricator

[MLIR] Allow `Idempotent` trait to be applied to binary ops.

Authored by chr1sj0nes on Thu, Nov 25, 1:23 AM.


Diff Detail

Event Timeline

chr1sj0nes created this revision.Thu, Nov 25, 1:23 AM

Formatting fix.

chr1sj0nes published this revision for review.Thu, Nov 25, 5:04 AM
mehdi_amini accepted this revision.Thu, Nov 25, 4:19 PM
mehdi_amini added inline comments.

Nit: no need for else after return

This revision is now accepted and ready to land.Thu, Nov 25, 4:19 PM

Thanks for the review Mehdi! Can you please submit if you are happy, as I don't have permissions.


I think the else is necessary here, as the if branch doesn't always return. Without the else, it might call op->getOperand(1) on an op with only one operand.

Cool. Is there any reason that idompotence be limited to unary and binary ops? Variadic "or" operations like comb.or in CIRCT seem like they should be able to participate as well.