diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2009-11-05 17:17:44 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2009-11-05 17:17:44 +0000 |
commit | ded64d5d348ce8d8c5aa42cf63f6de9dd84b7e89 (patch) | |
tree | adc0bc5dc9cb37579ee90d3c0f08c98c0711bebe /lib/Transforms/Scalar/SCCP.cpp | |
parent | ee2025263d979561bba11dc526f01d690a2565e7 (diff) | |
download | FreeBSD-src-ded64d5d348ce8d8c5aa42cf63f6de9dd84b7e89.zip FreeBSD-src-ded64d5d348ce8d8c5aa42cf63f6de9dd84b7e89.tar.gz |
Update LLVM to r86140.
Diffstat (limited to 'lib/Transforms/Scalar/SCCP.cpp')
-rw-r--r-- | lib/Transforms/Scalar/SCCP.cpp | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 05a0eee..509a6db 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -370,13 +370,13 @@ private: /// by properly seeding constants etc. LatticeVal &getValueState(Value *V) { assert(!isa<StructType>(V->getType()) && "Should use getStructValueState"); - - // TODO: Change to do insert+find in one operation. - DenseMap<Value*, LatticeVal>::iterator I = ValueState.find(V); - if (I != ValueState.end()) - return I->second; // Common case, already in the map. - LatticeVal &LV = ValueState[V]; + std::pair<DenseMap<Value*, LatticeVal>::iterator, bool> I = + ValueState.insert(std::make_pair(V, LatticeVal())); + LatticeVal &LV = I.first->second; + + if (!I.second) + return LV; // Common case, already in the map. if (Constant *C = dyn_cast<Constant>(V)) { // Undef values remain undefined. @@ -395,15 +395,15 @@ private: assert(isa<StructType>(V->getType()) && "Should use getValueState"); assert(i < cast<StructType>(V->getType())->getNumElements() && "Invalid element #"); - - // TODO: Change to do insert+find in one operation. - DenseMap<std::pair<Value*, unsigned>, LatticeVal>::iterator - I = StructValueState.find(std::make_pair(V, i)); - if (I != StructValueState.end()) - return I->second; // Common case, already in the map. - - LatticeVal &LV = StructValueState[std::make_pair(V, i)]; - + + std::pair<DenseMap<std::pair<Value*, unsigned>, LatticeVal>::iterator, + bool> I = StructValueState.insert( + std::make_pair(std::make_pair(V, i), LatticeVal())); + LatticeVal &LV = I.first->second; + + if (!I.second) + return LV; // Common case, already in the map. + if (Constant *C = dyn_cast<Constant>(V)) { if (isa<UndefValue>(C)) ; // Undef values remain undefined. @@ -1280,9 +1280,10 @@ CallOverdefined: } if (const StructType *STy = dyn_cast<StructType>(AI->getType())) { - for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) - mergeInValue(getStructValueState(AI, i), AI, - getStructValueState(*CAI, i)); + for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { + LatticeVal CallArg = getStructValueState(*CAI, i); + mergeInValue(getStructValueState(AI, i), AI, CallArg); + } } else { mergeInValue(AI, getValueState(*CAI)); } |