aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
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/Transforms
parent2c9489d6e96d99f77b6c31919805b5e61954deb2 (diff)
downloadexternal_llvm-107f41fad5f8df734c72cf39a016a7ea0d874388.zip
external_llvm-107f41fad5f8df734c72cf39a016a7ea0d874388.tar.gz
external_llvm-107f41fad5f8df734c72cf39a016a7ea0d874388.tar.bz2
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/Transforms')
-rw-r--r--lib/Transforms/Scalar/SimplifyLibCalls.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/SimplifyLibCalls.cpp b/lib/Transforms/Scalar/SimplifyLibCalls.cpp
index 02b26bd..761c309 100644
--- a/lib/Transforms/Scalar/SimplifyLibCalls.cpp
+++ b/lib/Transforms/Scalar/SimplifyLibCalls.cpp
@@ -438,7 +438,8 @@ static uint64_t GetStringLengthH(Value *V, SmallPtrSet<PHINode*, 32> &PHIs) {
// 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>(GEP->getOperand(0));
- if (!GV || !GV->isConstant() || !GV->hasInitializer())
+ if (!GV || !GV->isConstant() || !GV->hasInitializer() ||
+ GV->mayBeOverridden())
return 0;
Constant *GlobalInit = GV->getInitializer();