[PATCH] D146349: [InstCombine] Make `FoldOpIntoSelect` handle non-constants and use condition to deduce constants.
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 17 19:05:02 PDT 2023
goldstein.w.n created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
goldstein.w.n requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
1. Make `FoldOpIntoSelect` handle non-constants by returning `nullptr` instead of aborting.
2. Make the fold use the information present in the condition for deducing constants i.e: ``` %c = icmp eq i8 %x, 10 %s = select i1 %c, i8 3, i8 2 %r = mul i8 %x, %s ```
If we fold the `mul` into the select, on the true side we insert `10` for `%x` in the `mul`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D146349
Files:
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146349.506259.patch
Type: text/x-patch
Size: 6050 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230318/e57e362b/attachment.bin>
More information about the llvm-commits
mailing list