ValueTracking: Forward getConstantStringInfo's TrimAtNul param into recursive invocation
authorBenjamin Kramer <benny.kra@googlemail.com>
Sat, 21 Mar 2015 15:36:06 +0000 (15:36 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sat, 21 Mar 2015 15:36:06 +0000 (15:36 +0000)
Currently this is only used to tweak the backend's memcpy inlining
heuristics, testing that isn't very helpful. A real test case will
follow in the next commit, where this behavior would cause a real
miscompilation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232895 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ValueTracking.cpp

index edccd8c0914c3885c02da13e1347e047c0ba3695..0c66dab3267ddc77187cfbb848b502069b177a60 100644 (file)
@@ -2592,7 +2592,7 @@ bool llvm::getConstantStringInfo(const Value *V, StringRef &Str,
   // Look through bitcast instructions and geps.
   V = V->stripPointerCasts();
 
-  // If the value is a GEP instructionor  constant expression, treat it as an
+  // If the value is a GEP instruction or constant expression, treat it as an
   // offset.
   if (const GEPOperator *GEP = dyn_cast<GEPOperator>(V)) {
     // Make sure the GEP has exactly three arguments.
@@ -2619,7 +2619,8 @@ bool llvm::getConstantStringInfo(const Value *V, StringRef &Str,
       StartIdx = CI->getZExtValue();
     else
       return false;
-    return getConstantStringInfo(GEP->getOperand(0), Str, StartIdx+Offset);
+    return getConstantStringInfo(GEP->getOperand(0), Str, StartIdx + Offset,
+                                 TrimAtNul);
   }
 
   // The GEP instruction, constant or instruction, must reference a global