mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Do map insert+find in one step. TODO -= 2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86133 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e9684c682a
commit
bcaa2157dd
@ -371,12 +371,12 @@ private:
|
|||||||
LatticeVal &getValueState(Value *V) {
|
LatticeVal &getValueState(Value *V) {
|
||||||
assert(!isa<StructType>(V->getType()) && "Should use getStructValueState");
|
assert(!isa<StructType>(V->getType()) && "Should use getStructValueState");
|
||||||
|
|
||||||
// TODO: Change to do insert+find in one operation.
|
std::pair<DenseMap<Value*, LatticeVal>::iterator, bool> I =
|
||||||
DenseMap<Value*, LatticeVal>::iterator I = ValueState.find(V);
|
ValueState.insert(std::make_pair(V, LatticeVal()));
|
||||||
if (I != ValueState.end())
|
LatticeVal &LV = I.first->second;
|
||||||
return I->second; // Common case, already in the map.
|
|
||||||
|
|
||||||
LatticeVal &LV = ValueState[V];
|
if (!I.second)
|
||||||
|
return LV; // Common case, already in the map.
|
||||||
|
|
||||||
if (Constant *C = dyn_cast<Constant>(V)) {
|
if (Constant *C = dyn_cast<Constant>(V)) {
|
||||||
// Undef values remain undefined.
|
// Undef values remain undefined.
|
||||||
@ -396,13 +396,13 @@ private:
|
|||||||
assert(i < cast<StructType>(V->getType())->getNumElements() &&
|
assert(i < cast<StructType>(V->getType())->getNumElements() &&
|
||||||
"Invalid element #");
|
"Invalid element #");
|
||||||
|
|
||||||
// TODO: Change to do insert+find in one operation.
|
std::pair<DenseMap<std::pair<Value*, unsigned>, LatticeVal>::iterator,
|
||||||
DenseMap<std::pair<Value*, unsigned>, LatticeVal>::iterator
|
bool> I = StructValueState.insert(
|
||||||
I = StructValueState.find(std::make_pair(V, i));
|
std::make_pair(std::make_pair(V, i), LatticeVal()));
|
||||||
if (I != StructValueState.end())
|
LatticeVal &LV = I.first->second;
|
||||||
return I->second; // Common case, already in the map.
|
|
||||||
|
|
||||||
LatticeVal &LV = StructValueState[std::make_pair(V, i)];
|
if (!I.second)
|
||||||
|
return LV; // Common case, already in the map.
|
||||||
|
|
||||||
if (Constant *C = dyn_cast<Constant>(V)) {
|
if (Constant *C = dyn_cast<Constant>(V)) {
|
||||||
if (isa<UndefValue>(C))
|
if (isa<UndefValue>(C))
|
||||||
|
Loading…
Reference in New Issue
Block a user