[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Chris Lattner sabre at nondot.org
Sun Feb 25 10:40:49 PST 2007



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.374 -> 1.375
---
Log message:

optimize duplicate ValueMap lookups


---
Diffs of the changes:  (+6 -9)

 SelectionDAGISel.cpp |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.374 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.375
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.374	Sat Feb 24 03:45:44 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp	Sun Feb 25 12:40:32 2007
@@ -661,17 +661,14 @@
       return DAG.getFrameIndex(SI->second, TLI.getPointerTy());
   }
       
-  DenseMap<const Value*, unsigned>::iterator VMI =
-      FuncInfo.ValueMap.find(V);
-  assert(VMI != FuncInfo.ValueMap.end() && "Value not in map!");
-  
-  unsigned InReg = VMI->second;
+  unsigned InReg = FuncInfo.ValueMap[V];
+  assert(InReg && "Value not in map!");
   
   // If this type is not legal, make it so now.
   if (VT != MVT::Vector) {
     if (TLI.getTypeAction(VT) == TargetLowering::Expand) {
       // Source must be expanded.  This input value is actually coming from the
-      // register pair VMI->second and VMI->second+1.
+      // register pair InReg and InReg+1.
       MVT::ValueType DestVT = TLI.getTypeToExpandTo(VT);
       unsigned NumVals = TLI.getNumElements(VT);
       N = DAG.getCopyFromReg(DAG.getEntryNode(), InReg, DestVT);
@@ -4189,9 +4186,9 @@
 
       // If this argument is live outside of the entry block, insert a copy from
       // whereever we got it to the vreg that other BB's will reference it as.
-      if (FuncInfo.ValueMap.count(AI)) {
-        SDOperand Copy =
-          SDL.CopyValueToVirtualRegister(AI, FuncInfo.ValueMap[AI]);
+      DenseMap<const Value*, unsigned>::iterator VMI=FuncInfo.ValueMap.find(AI);
+      if (VMI != FuncInfo.ValueMap.end()) {
+        SDOperand Copy = SDL.CopyValueToVirtualRegister(AI, VMI->second);
         UnorderedChains.push_back(Copy);
       }
     }






More information about the llvm-commits mailing list