This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] allow Negator to fold multi-use select with constant arms
ClosedPublic

Authored by spatel on Oct 27 2021, 1:24 PM.

Details

Summary

The motivating test is reduced from:
https://llvm.org/PR52261

Note that the more general problem of folding any binop into a multi-use select of constants is still there. We need to ease the restriction in InstCombinerImpl::FoldOpIntoSelect() to catch those. But these examples never reach that code because Negator exclusively handles negation patterns within visitSub().

Diff Detail

Event Timeline

spatel created this revision.Oct 27 2021, 1:24 PM
spatel requested review of this revision.Oct 27 2021, 1:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 27 2021, 1:24 PM

Could you please precommit the tests?

Could you please precommit the tests?

Sorry - I had those queued up locally, but had not pushed:
e42c8bab4771

lebedev.ri accepted this revision.Oct 27 2021, 3:47 PM

This is only following the existing framework, which is wrong, but i'm out of energy.

This revision is now accepted and ready to land.Oct 27 2021, 3:47 PM
This revision was landed with ongoing or failed builds.Oct 28 2021, 5:36 AM
This revision was automatically updated to reflect the committed changes.