[llvm-commits] [llvm] r166395 - /llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp

Anders Carlsson andersca at mac.com
Sun Oct 21 09:26:35 PDT 2012


Author: andersca
Date: Sun Oct 21 11:26:35 2012
New Revision: 166395

URL: http://llvm.org/viewvc/llvm-project?rev=166395&view=rev
Log:
Avoid an extra hash lookup when inserting a value into the widen map.

Modified:
    llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp

Modified: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=166395&r1=166394&r2=166395&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Sun Oct 21 11:26:35 2012
@@ -398,13 +398,13 @@
 Value *SingleBlockLoopVectorizer::getVectorValue(Value *V) {
   assert(!V->getType()->isVectorTy() && "Can't widen a vector");
   // If we saved a vectorized copy of V, use it.
-  ValueMap::iterator it = WidenMap.find(V);
-  if (it != WidenMap.end())
-     return it->second;
+  Value *&MapEntry = WidenMap[V];
+  if (MapEntry)
+    return MapEntry;
 
   // Broadcast V and save the value for future uses.
   Value *B = getBroadcastInstrs(V);
-  WidenMap[V] = B;
+  MapEntry = B;
   return B;
 }
 





More information about the llvm-commits mailing list