[PATCH] D139630: [InstCombine] Fold logic-and/logic-or by distributive laws part2
chenglin.bi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 4 02:25:45 PST 2023
bcl5980 added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:2801
bool FalseLogicAnd = isa<SelectInst>(FalseVal);
- if (CondLogicAnd && FalseLogicAnd) {
- // (A ? B : 0) ? 1 : (A ? D : 0) --> A ? (B ? 1 : D) : 0
+ auto AndFactorization = [&](Value *Common, Value *InnerCond,
+ Value *InnerVal,
----------------
spatel wrote:
> Can we add some description of the different possibilities?
>
> I know that handling all of the patterns poison-safely is not uniform, but what if we use freeze to make it safe with regular logic ops instead:
> https://alive2.llvm.org/ce/z/xb_moG
>
> There is an existing code example for a similar transform below this block of code - search for "MayNeedFreeze".
>
>
So which way are you prefer now? Not uniform code without freeze instruction or use freeze asap to make code easier?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139630/new/
https://reviews.llvm.org/D139630
More information about the llvm-commits
mailing list