diff options
author | Chris Lattner <sabre@nondot.org> | 2010-02-11 05:11:54 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-02-11 05:11:54 +0000 |
commit | 98df4f9cf2dea81af1cc2e68f23b285d22cebc6a (patch) | |
tree | 47c8b84c69a8ce4c6f5dc24df0ded8eac4168e6c /lib | |
parent | 5cc25ce17d7d730b33803ae23a17c05a39427cce (diff) | |
download | external_llvm-98df4f9cf2dea81af1cc2e68f23b285d22cebc6a.zip external_llvm-98df4f9cf2dea81af1cc2e68f23b285d22cebc6a.tar.gz external_llvm-98df4f9cf2dea81af1cc2e68f23b285d22cebc6a.tar.bz2 |
Make DSE only scan blocks that are reachable from the entry
block. Other blocks may have pointer cycles that will crash
basicaa and other alias analyses. In any case, there is no
point wasting cycles optimizing dead blocks. This fixes
rdar://7635088
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95852 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/DeadStoreElimination.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/DeadStoreElimination.cpp b/lib/Transforms/Scalar/DeadStoreElimination.cpp index 320afa1..09c01d3 100644 --- a/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -44,8 +44,14 @@ namespace { virtual bool runOnFunction(Function &F) { bool Changed = false; + + DominatorTree &DT = getAnalysis<DominatorTree>(); + for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) - Changed |= runOnBasicBlock(*I); + // Only check non-dead blocks. Dead blocks may have strange pointer + // cycles that will confuse alias analysis. + if (DT.isReachableFromEntry(I)) + Changed |= runOnBasicBlock(*I); return Changed; } |