Do one map lookup instead of two.
[oota-llvm.git] / lib / CodeGen / SelectionDAG / FastISel.cpp
index 1996c192ec7120041e06c41f7c1988824dcfbbe8..95f4d072e01f16f5a6e5c5963562ab481563e3c0 100644 (file)
@@ -99,8 +99,9 @@ unsigned FastISel::getRegForValue(const Value *V) {
   // cache values defined by Instructions across blocks, and other values
   // only locally. This is because Instructions already have the SSA
   // def-dominates-use requirement enforced.
-  if (ValueMap.count(V))
-    return ValueMap[V];
+  DenseMap<const Value *, unsigned>::iterator I = ValueMap.find(V);
+  if (I != ValueMap.end())
+    return I->second;
   unsigned Reg = LocalValueMap[V];
   if (Reg != 0)
     return Reg;