diff options
| author | Owen Anderson <resistor@mac.com> | 2007-08-08 17:58:56 +0000 | 
|---|---|---|
| committer | Owen Anderson <resistor@mac.com> | 2007-08-08 17:58:56 +0000 | 
| commit | 50df9685b029c71c0bce41982d088d1027777449 (patch) | |
| tree | 145b5f8974cf640669985e01ef891d34be74f1ba /llvm/lib/Transforms | |
| parent | 52aaabf74d2d8e19385f07d7c4018e51dec852fb (diff) | |
| download | bcm5719-llvm-50df9685b029c71c0bce41982d088d1027777449.tar.gz bcm5719-llvm-50df9685b029c71c0bce41982d088d1027777449.zip | |
Small improvement: if a function doesn't access memory, we don't need to scan
it for potentially undeading pointers.
llvm-svn: 40933
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp | 10 | 
1 files changed, 8 insertions, 2 deletions
| diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp index 39a0aba2c95..bcf674ed37f 100644 --- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -287,6 +287,13 @@ bool DSE::handleEndBlock(BasicBlock& BB,        deadPointers.erase(A);        continue;      } else if (CallSite::get(BBI).getInstruction() != 0) { +      // If this call does not access memory, it can't +      // be undeadifying any of our pointers. +      CallSite CS = CallSite::get(BBI); +      if (CS.getCalledFunction() && +          AA.doesNotAccessMemory(CS.getCalledFunction())) +        continue; +              // Remove any pointers made undead by the call from the dead set        std::vector<Instruction*> dead;        for (SmallPtrSet<AllocaInst*, 64>::iterator I = deadPointers.begin(), @@ -298,8 +305,7 @@ bool DSE::handleEndBlock(BasicBlock& BB,                          TD.getTypeSize((*I)->getAllocatedType());               // See if the call site touches it -        AliasAnalysis::ModRefResult A = AA.getModRefInfo(CallSite::get(BBI), -                                                         *I, pointerSize); +        AliasAnalysis::ModRefResult A = AA.getModRefInfo(CS, *I, pointerSize);          if (A == AliasAnalysis::ModRef || A == AliasAnalysis::Ref)            dead.push_back(*I);        } | 

