This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Optimize 'xor-and-select' sequence to 'or' for bool
AbandonedPublic

Authored by Qi-Hu on Sep 13 2023, 4:47 PM.

Details

Reviewers
bryanpkc
Summary

Diff Detail

Event Timeline

Qi-Hu created this revision.Sep 13 2023, 4:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 13 2023, 4:47 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
Qi-Hu requested review of this revision.Sep 13 2023, 4:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 13 2023, 4:47 PM
goldstein.w.n added inline comments.
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
3184
  1. You can also do and case: https://alive2.llvm.org/ce/z/adHMjn (if the ~ op is the trueval).
  2. This probably belongs in foldSelectOfBools.
goldstein.w.n added inline comments.Sep 19 2023, 11:01 AM
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
3184

Actually should be able to handle all 4 of these cases:
https://alive2.llvm.org/ce/z/BgAFyN

Qi-Hu added inline comments.Sep 19 2023, 12:17 PM
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
3184

Thank you for the suggestions! Actually I submitted this patch as a pull request: 66394 (which was closed due to another PR implementing the same feature). I should've closed this revision.

Qi-Hu added inline comments.Sep 19 2023, 12:21 PM
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
3184

Thank you for the suggestions! Actually I submitted this patch as a pull request: 66394 (which was closed due to another PR implementing the same feature). I should've closed this revision.

Qi-Hu abandoned this revision.Sep 19 2023, 12:28 PM