[PATCH] D139630: [InstCombine] Fold logic-and/logic-or by distributive laws part2
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 4 09:35:03 PST 2023
spatel 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,
----------------
bcl5980 wrote:
> 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?
If there are no known regressions, let's go straight to the code with freeze. That should be the ideal form for most of these patterns.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139630/new/
https://reviews.llvm.org/D139630
More information about the llvm-commits
mailing list