[llvm-commits] [llvm] r129293 - /llvm/trunk/include/llvm/CodeGen/SlotIndexes.h

Jakob Stoklund Olesen stoklund at 2pi.dk
Mon Apr 11 13:01:44 PDT 2011


Author: stoklund
Date: Mon Apr 11 15:01:44 2011
New Revision: 129293

URL: http://llvm.org/viewvc/llvm-project?rev=129293&view=rev
Log:
Skip a binary search when possible.

Modified:
    llvm/trunk/include/llvm/CodeGen/SlotIndexes.h

Modified: llvm/trunk/include/llvm/CodeGen/SlotIndexes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SlotIndexes.h?rev=129293&r1=129292&r2=129293&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SlotIndexes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SlotIndexes.h Mon Apr 11 15:01:44 2011
@@ -545,6 +545,8 @@
 
     /// Returns the basic block which the given index falls in.
     MachineBasicBlock* getMBBFromIndex(SlotIndex index) const {
+      if (MachineInstr *MI = getInstructionFromIndex(index))
+        return MI->getParent();
       SmallVectorImpl<IdxMBBPair>::const_iterator I =
         std::lower_bound(idx2MBBMap.begin(), idx2MBBMap.end(), index);
       // Take the pair containing the index





More information about the llvm-commits mailing list