Index: llvm/lib/Target/X86/X86ISelLowering.cpp =================================================================== --- llvm/lib/Target/X86/X86ISelLowering.cpp +++ llvm/lib/Target/X86/X86ISelLowering.cpp @@ -44999,9 +44999,11 @@ unsigned NumElts = VecVT.getVectorNumElements(); unsigned NumEltBits = VecVT.getScalarSizeInBits(); - bool IsAnyOf = CmpOpcode == X86ISD::CMP && CmpVal.isZero(); + bool IsAnyOf = CmpOpcode == X86ISD::CMP && CmpVal.isZero() && + CmpOp.getNode()->hasOneUse(); bool IsAllOf = (CmpOpcode == X86ISD::SUB || CmpOpcode == X86ISD::CMP) && - NumElts <= CmpBits && CmpVal.isMask(NumElts); + NumElts <= CmpBits && CmpVal.isMask(NumElts) && + CmpOp.getNode()->hasOneUse(); if (!IsAnyOf && !IsAllOf) return SDValue();