This is an archive of the discontinued LLVM Phabricator instance.

IR/PatternMatch: Mark m_Mul as commutable
AbandonedPublic

Authored by arsenm on Apr 25 2022, 6:53 AM.

Details

Summary

I'm surprised this wasn't already marked commutable. I'm even more
surprised no tests broke from this, except for the ones in the case I
noticed.

I'm assuming this is because instcombine has a canonical ordering for
mul operands and makes this irrelevant most of the time. The problem I
encounterd was in a backend IR pass matching the output from another
backend IR pass when there's really no point in running any other IR
optimizations between them.

Diff Detail

Event Timeline

arsenm created this revision.Apr 25 2022, 6:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 25 2022, 6:53 AM
arsenm requested review of this revision.Apr 25 2022, 6:53 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 25 2022, 6:53 AM
Herald added a subscriber: wdng. · View Herald Transcript
nikic requested changes to this revision.Apr 25 2022, 7:50 AM
nikic added a subscriber: nikic.

We use separate matchers for commutative variants, in this case m_c_Mul().

This revision now requires changes to proceed.Apr 25 2022, 7:50 AM
arsenm abandoned this revision.Apr 29 2022, 3:25 PM