aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/IPO/GlobalOpt.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-05-22 07:15:13 +0000
committerChris Lattner <sabre@nondot.org>2011-05-22 07:15:13 +0000
commit98a42b2fc39f3fc46905fb98078cce4ce4e0a827 (patch)
tree3f1d8c200430e0b4c16dce01d87ed75ddf82d4f2 /lib/Transforms/IPO/GlobalOpt.cpp
parent9e7bc05ad7fb69a25aff37e348942b07eed9cd73 (diff)
downloadexternal_llvm-98a42b2fc39f3fc46905fb98078cce4ce4e0a827.zip
external_llvm-98a42b2fc39f3fc46905fb98078cce4ce4e0a827.tar.gz
external_llvm-98a42b2fc39f3fc46905fb98078cce4ce4e0a827.tar.bz2
fix PR9856, an incorrectly conservative assertion: a global can be
"stored once" even if its address is compared. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131849 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/GlobalOpt.cpp')
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index ded58ac..9d98bb1 100644
--- a/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/lib/Transforms/IPO/GlobalOpt.cpp
@@ -799,7 +799,8 @@ static bool OptimizeAwayTrappingUsesOfLoads(GlobalVariable *GV, Constant *LV) {
// If we get here we could have other crazy uses that are transitively
// loaded.
assert((isa<PHINode>(GlobalUser) || isa<SelectInst>(GlobalUser) ||
- isa<ConstantExpr>(GlobalUser)) && "Only expect load and stores!");
+ isa<ConstantExpr>(GlobalUser) || isa<CmpInst>(GlobalUser)) &&
+ "Only expect load and stores!");
}
}
@@ -1589,8 +1590,7 @@ static bool OptimizeOnceStoredGlobal(GlobalVariable *GV, Value *StoredOnceVal,
GV->getInitializer()->isNullValue()) {
if (Constant *SOVC = dyn_cast<Constant>(StoredOnceVal)) {
if (GV->getInitializer()->getType() != SOVC->getType())
- SOVC =
- ConstantExpr::getBitCast(SOVC, GV->getInitializer()->getType());
+ SOVC = ConstantExpr::getBitCast(SOVC, GV->getInitializer()->getType());
// Optimize away any trapping uses of the loaded value.
if (OptimizeAwayTrappingUsesOfLoads(GV, SOVC))