This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] use isFreeToInvert to generalize min/max with 'not'
ClosedPublic

Authored by spatel on Sep 1 2021, 5:59 AM.

Details

Summary

This mimics the code for the corresponding cmp-select idiom.

This also prevents an infinite loop because isFreeToInvert does not match constant expressions.

So this patch solves the same problem as D108814 and would overwrite it, but my main motivation is to enhance the pattern matching to allow more invertible ops. I'll post that change as a follow-up patch on top of this one.

Diff Detail

Event Timeline

spatel created this revision.Sep 1 2021, 5:59 AM
spatel requested review of this revision.Sep 1 2021, 5:59 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 1 2021, 5:59 AM
nikic accepted this revision.Sep 1 2021, 9:44 AM

LG

This revision is now accepted and ready to land.Sep 1 2021, 9:44 AM
This revision was landed with ongoing or failed builds.Sep 1 2021, 11:35 AM
This revision was automatically updated to reflect the committed changes.