[llvm] [X86] Fix assertion in AVX512 setcc combine due to invalid APInt mask width (PR #155775)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 28 01:01:44 PDT 2025


================
@@ -56247,7 +56247,13 @@ static SDValue combineAVX512SetCCToKMOV(EVT VT, SDValue Op0, ISD::CondCode CC,
 
   SDValue Masked = BroadcastOp;
   if (N != 0) {
-    APInt Mask = APInt::getLowBitsSet(BroadcastOpVT.getSizeInBits(), Len);
+    unsigned BroadcastOpBitWidth = BroadcastOpVT.getSizeInBits();
+    unsigned NumDefinedElts = UndefElts.getBitWidth() - UndefElts.popcount();
----------------
phoebewang wrote:

Should it be `UndefElts.getActiveBits`?

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


More information about the llvm-commits mailing list