[llvm] [InstCombine] Extend #125676 to handle variable power of 2 (PR #125855)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 5 18:03:38 PST 2025


================
@@ -4200,14 +4200,14 @@ Value *InstCombinerImpl::foldXorOfICmps(ICmpInst *LHS, ICmpInst *RHS,
 
     // Fold (icmp eq/ne (X & Pow2), 0) ^ (icmp eq/ne (Y & Pow2), 0) into
     // (icmp eq/ne ((X ^ Y) & Pow2), 0)
-    Value *X, *Y;
-    const APInt *Mask;
+    Value *X, *Y, *Mask;
     if (ICmpInst::isEquality(PredL) && ICmpInst::isEquality(PredR) &&
         LC->isZero() && RC->isZero() && LHS->hasOneUse() && RHS->hasOneUse() &&
----------------
goldsteinn wrote:

The cmp that has one use would also need its op to have one use i.e `(LHS->hasOneUse() && LHS0->hasOneUse()) || (RHS->hasOneUse() && RHS0->hasOneUse())`. And that would only make it break even.

https://github.com/llvm/llvm-project/pull/125855


More information about the llvm-commits mailing list