diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 3a4e457161e..570cac8e261 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -3376,7 +3376,7 @@ void SelectionDAGLowering::visitMemIntrinsic(CallInst &I, unsigned Op) { } if (G) { GlobalVariable *GV = dyn_cast(G->getGlobal()); - if (GV) { + if (GV && GV->isConstant()) { Str = GV->getStringValue(false); if (!Str.empty()) { CopyFromStr = true;