diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-12-09 19:47:40 +0000 | 
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-12-09 19:47:40 +0000 | 
| commit | 41efb68c444265e48bfc038d112d43e5fec5a69a (patch) | |
| tree | bda46ea7091d05abb62deb6579bca70a9799dffc /llvm/lib/Analysis | |
| parent | 254314e6bce70360f7755f9979444b4d54da4f93 (diff) | |
| download | bcm5719-llvm-41efb68c444265e48bfc038d112d43e5fec5a69a.tar.gz bcm5719-llvm-41efb68c444265e48bfc038d112d43e5fec5a69a.zip | |
Fix a fixme: allow memdep to see past read-only calls when doing
load dependence queries.  This allows GVN to eliminate a few more
instructions on 403.gcc:
 152598 gvn    - Number of instructions deleted
  49240 gvn    - Number of loads deleted
after:
 153986 gvn    - Number of instructions deleted
  50069 gvn    - Number of loads deleted
llvm-svn: 60786
Diffstat (limited to 'llvm/lib/Analysis')
| -rw-r--r-- | llvm/lib/Analysis/MemoryDependenceAnalysis.cpp | 17 | 
1 files changed, 13 insertions, 4 deletions
| diff --git a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp index cd63c0fc52c..9fcbd8dbf05 100644 --- a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -213,11 +213,20 @@ getPointerDependencyFrom(Value *MemPtr, uint64_t MemSize, bool isLoad,      // See if this instruction (e.g. a call or vaarg) mod/ref's the pointer.      // FIXME: If this is a load, we should ignore readonly calls! -    if (AA->getModRefInfo(Inst, MemPtr, MemSize) == AliasAnalysis::NoModRef) +    switch (AA->getModRefInfo(Inst, MemPtr, MemSize)) { +    case AliasAnalysis::NoModRef: +      // If the call has no effect on the queried pointer, just ignore it.        continue; -     -    // Otherwise, there is a dependence. -    return MemDepResult::getClobber(Inst); +    case AliasAnalysis::Ref: +      // If the call is known to never store to the pointer, and if this is a +      // load query, we can safely ignore it (scan past it). +      if (isLoad) +        continue; +      // FALL THROUGH. +    default: +      // Otherwise, there is a potential dependence.  Return a clobber. +      return MemDepResult::getClobber(Inst); +    }    }    // No dependence found.  If this is the entry block of the function, it is a | 

