[PATCH] D96945: [InstCombine] Add simplification of two logical and/ors
Juneyoung Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 7 04:05:34 PST 2021
aqjune added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:2640
+ match(FalseVal, m_c_LogicalOr(m_Specific(CondVal), m_Value(B))))
+ return replaceOperand(SI, 2, B);
+
----------------
aqjune wrote:
> nikic wrote:
> > What currently happens for something like `a ? (a | b) : false`? I assume it doesn't get folded?
> No, it doesn't get folded.
> That being said, I think it is better to simply propagate true/false to select operands, e.g.
> `a ? (a | b) : false` -> `a ? (true | b) : false` -> `a ? b : false`. I'll update this patch to do so.
Nevermind, since the replacement needs to take care of # uses but the current version doesn't need it, I think it does not completely cover the foldings in this patch.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96945/new/
https://reviews.llvm.org/D96945
More information about the llvm-commits
mailing list