[llvm] [X86] Remove redundant and-not pattern code in X86 (PR #157687)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 9 09:20:14 PDT 2025


================
@@ -3489,19 +3489,8 @@ bool X86TargetLowering::isMaskAndCmp0FoldingBeneficial(
 }
 
 bool X86TargetLowering::hasAndNotCompare(SDValue Y) const {
-  EVT VT = Y.getValueType();
-
-  if (VT.isVector())
-    return false;
-
-  if (!Subtarget.hasBMI())
-    return false;
-
-  // There are only 32-bit and 64-bit forms for 'andn'.
-  if (VT != MVT::i32 && VT != MVT::i64)
-    return false;
-
-  return !isa<ConstantSDNode>(Y) || cast<ConstantSDNode>(Y)->isOpaque();
+  // Can use andn for any scalar integer.
----------------
AZero13 wrote:

True, my bad. But we can still do the compare with test and stuff.

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


More information about the llvm-commits mailing list