[llvm] r229175 - Minor tweak to MDA
Philip Reames
listmail at philipreames.com
Fri Feb 13 15:08:37 PST 2015
Author: reames
Date: Fri Feb 13 17:08:37 2015
New Revision: 229175
URL: http://llvm.org/viewvc/llvm-project?rev=229175&view=rev
Log:
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
Modified:
llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=229175&r1=229174&r2=229175&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Fri Feb 13 17:08:37 2015
@@ -423,7 +423,9 @@ getPointerDependencyFrom(const AliasAnal
}
// 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))
More information about the llvm-commits
mailing list