[llvm] [InstCombine] move foldAndOrOfICmpsOfAndWithPow2 in to foldLogOpOfMaskedICmps (PR #121970)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 7 10:43:22 PST 2025
================
@@ -591,10 +592,9 @@ static Value *foldLogOpOfMaskedICmps(ICmpInst *LHS, ICmpInst *RHS, bool IsAnd,
// their actual values. This isn't strictly necessary, just a "handle the
// easy cases for now" decision.
const APInt *ConstB, *ConstD;
- if (!match(B, m_APInt(ConstB)) || !match(D, m_APInt(ConstD)))
- return nullptr;
+ bool DBconst = match(B, m_APInt(ConstB)) && match(D, m_APInt(ConstD));
- if (Mask & (Mask_NotAllZeros | BMask_NotAllOnes)) {
+ if (DBconst && Mask & (Mask_NotAllZeros | BMask_NotAllOnes)) {
----------------
goldsteinn wrote:
might be cleaner to just nest all of the stuff that relies on B/D being const in an if.
https://github.com/llvm/llvm-project/pull/121970
More information about the llvm-commits
mailing list