diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index f4ec6afd540..162979b8039 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -4562,8 +4562,9 @@ SDOperand X86TargetLowering::LowerMEMSET(SDOperand Op, SelectionDAG &DAG) { (I && I->getValue() > Subtarget->getMaxInlineSizeThreshold())) { // Check to see if there is a specialized entry-point for memory zeroing. - const char *bzeroEntry = Subtarget->getBZeroEntry(); ConstantSDNode *V = dyn_cast(Op.getOperand(2)); + const char *bzeroEntry = + V && V->isNullValue() ? Subtarget->getBZeroEntry() : 0; MVT::ValueType IntPtr = getPointerTy(); const Type *IntPtrTy = getTargetData()->getIntPtrType();