This is an archive of the discontinued LLVM Phabricator instance.

[NFC][InstCombine] Refactor InstCombinerImpl::foldSelectIntoOp
ClosedPublic

Authored by david-arm on Jun 10 2022, 6:04 AM.

Details

Summary

Introduce a lambda function so that we remove a lot of code
duplication.

Diff Detail

Event Timeline

david-arm created this revision.Jun 10 2022, 6:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 10 2022, 6:04 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
david-arm requested review of this revision.Jun 10 2022, 6:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 10 2022, 6:04 AM
spatel accepted this revision.Jun 10 2022, 8:58 AM

LGTM - thanks!

Note that we likely have FMF propagation bugs in this code based on discussion/examples in D127275. If you can put a TODO comment on this, that would be helpful. We'll probably need to add more tests with mixed FMF to demonstrate the bugs.

llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
442–458

Changing only the capitalization of the enclosing function surprised me (and it doesn't seem like there's consensus on capitalization for lambda names).

"TryFoldSelectIntoOp" ?

This revision is now accepted and ready to land.Jun 10 2022, 8:58 AM
This revision was landed with ongoing or failed builds.Jun 13 2022, 2:37 AM
This revision was automatically updated to reflect the committed changes.