forked from OSchip/llvm-project
ValueTracking: Forward getConstantStringInfo's TrimAtNul param into recursive invocation
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. llvm-svn: 232895
This commit is contained in:
parent
307cb8fe5d
commit
0248a3e549
|
@ -2592,7 +2592,7 @@ bool llvm::getConstantStringInfo(const Value *V, StringRef &Str,
|
||||||
// Look through bitcast instructions and geps.
|
// Look through bitcast instructions and geps.
|
||||||
V = V->stripPointerCasts();
|
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.
|
// offset.
|
||||||
if (const GEPOperator *GEP = dyn_cast<GEPOperator>(V)) {
|
if (const GEPOperator *GEP = dyn_cast<GEPOperator>(V)) {
|
||||||
// Make sure the GEP has exactly three arguments.
|
// Make sure the GEP has exactly three arguments.
|
||||||
|
@ -2619,7 +2619,8 @@ bool llvm::getConstantStringInfo(const Value *V, StringRef &Str,
|
||||||
StartIdx = CI->getZExtValue();
|
StartIdx = CI->getZExtValue();
|
||||||
else
|
else
|
||||||
return false;
|
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
|
// The GEP instruction, constant or instruction, must reference a global
|
||||||
|
|
Loading…
Reference in New Issue