aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-08-19 00:11:12 +0000
committerDan Gohman <gohman@apple.com>2009-08-19 00:11:12 +0000
commit107f41fad5f8df734c72cf39a016a7ea0d874388 (patch)
tree4eb7a844e364bb61f523a4d8cdf78930a3f047c4 /lib/Analysis/ValueTracking.cpp
parent2c9489d6e96d99f77b6c31919805b5e61954deb2 (diff)
Fix SimplifyLibcalls and ValueTracking to check mayBeOverridden
before performing optimizations based on constant string values. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79384 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ValueTracking.cpp')
-rw-r--r--lib/Analysis/ValueTracking.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp
index 604d10c68b..3ab10c55d8 100644
--- a/lib/Analysis/ValueTracking.cpp
+++ b/lib/Analysis/ValueTracking.cpp
@@ -1061,7 +1061,8 @@ bool llvm::GetConstantStringInfo(Value *V, std::string &Str, uint64_t Offset,
// variable that is a constant and is initialized. The referenced constant
// initializer is the array that we'll use for optimization.
GlobalVariable* GV = dyn_cast<GlobalVariable>(V);
- if (!GV || !GV->isConstant() || !GV->hasInitializer())
+ if (!GV || !GV->isConstant() || !GV->hasInitializer() ||
+ GV->mayBeOverridden())
return false;
Constant *GlobalInit = GV->getInitializer();