diff options
| author | Philip Reames <listmail@philipreames.com> | 2015-02-13 23:08:37 +0000 |
|---|---|---|
| committer | Philip Reames <listmail@philipreames.com> | 2015-02-13 23:08:37 +0000 |
| commit | 66facd6c1412ebf3f1a850cffdcfc86dcce0a6c3 (patch) | |
| tree | 1df89dfd5257ed58c499acb3bdda6a4a983eb916 /llvm/lib/Analysis/MemoryDependenceAnalysis.cpp | |
| parent | 6393bae4f9089efc8f1be01003ccb714de706106 (diff) | |
| download | bcm5719-llvm-66facd6c1412ebf3f1a850cffdcfc86dcce0a6c3.tar.gz bcm5719-llvm-66facd6c1412ebf3f1a850cffdcfc86dcce0a6c3.zip | |
Minor tweak to MDA
Two minor tweaks I noticed when reading through the code:
- No need to recompute begin() on every iteration. We're not modifying the instructions in this loop.
- We can ignore PHINodes and Dbg intrinsics. The current code does this anyways, but it will spend slightly more time doing so and will count towards the limit of instructions in the block. It seems really silly to give up due the presence of PHIs...
Differential Revision: http://reviews.llvm.org/D7624
llvm-svn: 229175
Diffstat (limited to 'llvm/lib/Analysis/MemoryDependenceAnalysis.cpp')
| -rw-r--r-- | llvm/lib/Analysis/MemoryDependenceAnalysis.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp index bcfea647b52..fa67aeb1bce 100644 --- a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -423,7 +423,9 @@ getPointerDependencyFrom(const AliasAnalysis::Location &MemLoc, bool isLoad, } // Walk backwards through the basic block, looking for dependencies. - while (ScanIt != BB->begin()) { + // We can stop before processing PHIs or dbg intrinsics. + const BasicBlock::iterator Begin(BB->getFirstNonPHIOrDbg()); + while (ScanIt != Begin) { Instruction *Inst = --ScanIt; if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(Inst)) |

