aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-10-07 06:01:25 +0000
committerChris Lattner <sabre@nondot.org>2004-10-07 06:01:25 +0000
commit3602549c3dbce144bdfc5b0db784c60880a3062f (patch)
tree263c15bef375af931ba97de1dd7a5289d81a9945
parentbc53e5e628940153d015cf46ac45fb7cfcb39c4f (diff)
downloadexternal_llvm-3602549c3dbce144bdfc5b0db784c60880a3062f.zip
external_llvm-3602549c3dbce144bdfc5b0db784c60880a3062f.tar.gz
external_llvm-3602549c3dbce144bdfc5b0db784c60880a3062f.tar.bz2
Fix a bug in the safety analysis routine
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16804 91177308-0d34-0410-b5e6-96231b3b80d8
-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 8e563cb..74e5649 100644
--- a/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/lib/Transforms/IPO/GlobalOpt.cpp
@@ -69,6 +69,9 @@ static bool AnalyzeGlobal(Value *V, GlobalStatus &GS,
if (isa<LoadInst>(I)) {
GS.isLoaded = true;
} else if (StoreInst *SI = dyn_cast<StoreInst>(I)) {
+ // Don't allow a store OF the address, only stores TO the address.
+ if (SI->getOperand(0) == V) return true;
+
// If this store is just storing the initializer into a global (i.e. not
// changing the value), ignore it. For now we just handle direct
// stores, no stores to fields of aggregates.
@@ -239,9 +242,6 @@ bool GlobalOpt::runOnModule(Module &M) {
++NumMarked;
Changed = true;
- } else if (!GS.isNotSuitableForSRA &&
- !GV->getInitializer()->getType()->isFirstClassType()) {
- //std::cerr << "COULD SRA: " << *GV;
}
}
}