Oops...I committed too much.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66867 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 8e89629..b2a6864 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -11043,12 +11043,11 @@
   if (ConstantExpr *CE = dyn_cast<ConstantExpr>(CI)) {
     // Instead of loading constant c string, use corresponding integer value
     // directly if string length is small enough.
-    const char *Str = GetConstantStringInfo(CE->getOperand(0));
-    if (Str) {
-      unsigned len = strlen(Str);
+    std::string Str;
+    if (GetConstantStringInfo(CE->getOperand(0), Str) && !Str.empty()) {
+      unsigned len = Str.length();
       const Type *Ty = cast<PointerType>(CE->getType())->getElementType();
       unsigned numBits = Ty->getPrimitiveSizeInBits();
-
       // Replace LI with immediate integer store.
       if ((numBits >> 3) == len + 1) {
         APInt StrVal(numBits, 0);