diff --git a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp index 27a2f2fdaa19..a927207f66a5 100644 --- a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp +++ b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp @@ -787,7 +787,7 @@ bool MemCpyOpt::processMemCpy(MemCpyInst *M) { // If copying from a constant, try to turn the memcpy into a memset. if (GlobalVariable *GV = dyn_cast(M->getSource())) - if (!GV->mayBeOverridden() && GV->isConstant() && GV->hasInitializer()) + if (GV->isConstant() && GV->hasDefinitiveInitializer()) if (Value *ByteVal = isBytewiseValue(GV->getInitializer())) { Value *Ops[] = { M->getRawDest(), ByteVal, // Start, value