This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] allow more min/max with 'not' folds for intrinsics
ClosedPublic

Authored by spatel on Sep 1 2021, 6:08 AM.

Details

Summary

isFreeToInvert allows min/max with 'not' on both operands, so easing the argument restriction catches the case where that operand has one use.

We already handle the sub-patterns when there are less uses:
https://alive2.llvm.org/ce/z/8Jatm_

...but this is another step towards parity with the equivalent icmp+select idioms ( D98152 ).

Diff Detail

Event Timeline

spatel created this revision.Sep 1 2021, 6:08 AM
spatel requested review of this revision.Sep 1 2021, 6:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 1 2021, 6:08 AM
spatel added a comment.Sep 1 2021, 8:42 AM

For reference/remaining steps - to avoid regressions on some important benchmarks, we probably need min/max intrinsics patches that give us functionality like:
D45317
D51398
D52177

It took several folds to see through patterns in cmyk code where the instructions have multi-uses.

nikic accepted this revision.Sep 1 2021, 9:47 AM

LG

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