From: Anders Carlsson Date: Sun, 21 Oct 2012 16:26:35 +0000 (+0000) Subject: Avoid an extra hash lookup when inserting a value into the widen map. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=5bb5a75b1e47443ba9b07a53e6e967d29108bab3;p=oota-llvm.git Avoid an extra hash lookup when inserting a value into the widen map. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166395 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp index dfa29093e68..a041169876c 100644 --- a/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -398,13 +398,13 @@ bool LoopVectorizationLegality::isConsecutiveGep(Value *Ptr) { 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; }