Skip to content

Commit a341820

Browse files
[LiveDebugValues] Simplify code with MapVector::insert_or_assign (NFC) (#110398)
Note that we must use insert_or_assign because operator[] would require DbgValue to have the default constructor.
1 parent 8a9e9a8 commit a341820

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,9 +1070,7 @@ class VLocTracker {
10701070
: DbgValue(Properties, DbgValue::Undef);
10711071

10721072
// Attempt insertion; overwrite if it's already mapped.
1073-
auto Result = Vars.insert(std::make_pair(VarID, Rec));
1074-
if (!Result.second)
1075-
Result.first->second = Rec;
1073+
Vars.insert_or_assign(VarID, Rec);
10761074
Scopes[VarID] = MI.getDebugLoc().get();
10771075

10781076
considerOverlaps(Var, MI.getDebugLoc().get());
@@ -1100,9 +1098,7 @@ class VLocTracker {
11001098
DbgValue Rec = DbgValue(EmptyProperties, DbgValue::Undef);
11011099

11021100
// Attempt insertion; overwrite if it's already mapped.
1103-
auto Result = Vars.insert(std::make_pair(OverlappedID, Rec));
1104-
if (!Result.second)
1105-
Result.first->second = Rec;
1101+
Vars.insert_or_assign(OverlappedID, Rec);
11061102
Scopes[OverlappedID] = Loc;
11071103
}
11081104
}

0 commit comments

Comments
 (0)