[PATCH] Minor tweak to MDA

Philip Reames listmail at philipreames.com
Fri Feb 13 14:14:24 PST 2015


Hi hfinkel, nicholas, jfb,

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...

http://reviews.llvm.org/D7624

Files:
  lib/Analysis/MemoryDependenceAnalysis.cpp

Index: lib/Analysis/MemoryDependenceAnalysis.cpp
===================================================================
--- lib/Analysis/MemoryDependenceAnalysis.cpp
+++ lib/Analysis/MemoryDependenceAnalysis.cpp
@@ -423,7 +423,9 @@
   }
 
   // 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))

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7624.19932.patch
Type: text/x-patch
Size: 592 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150213/90a56342/attachment.bin>


More information about the llvm-commits mailing list