[PATCH] D123159: [InstCombine] Fold icmp(X) ? f(X) : C
Alexander Shaposhnikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 5 14:45:17 PDT 2022
alexander-shaposhnikov created this revision.
alexander-shaposhnikov added reviewers: nikic, lebedev.ri.
alexander-shaposhnikov created this object with visibility "All Users".
Herald added a subscriber: hiraditya.
Herald added a project: All.
alexander-shaposhnikov requested review of this revision.
Herald added a project: LLVM.
This diff extends foldSelectInstWithICmp to handle the case `icmp(X) ? f(X) : C`
when f(X) is guaranteed to be equal to C for all X in the exact range of the inverse predicate.
This addresses the issue https://github.com/llvm/llvm-project/issues/54089 .
Test plan:
1. ninja check-llvm && ninja check-clang
2. bootstrapped Clang passes the tests
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D123159
Files:
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
llvm/test/Transforms/InstCombine/select-binop-cmp.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123159.420640.patch
Type: text/x-patch
Size: 4522 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220405/63cb5be2/attachment.bin>
More information about the llvm-commits
mailing list