diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/BasicBlockUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp index f814204..04b2d1a 100644 --- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -511,7 +511,7 @@ DbgVariableRecordsRemoveRedundantDbgInstrsUsingForwardScan(BasicBlock *BB) { continue; DebugVariable Key(DVR.getVariable(), std::nullopt, DVR.getDebugLoc()->getInlinedAt()); - auto VMI = VariableMap.find(Key); + auto [VMI, Inserted] = VariableMap.try_emplace(Key); // A dbg.assign with no linked instructions can be treated like a // dbg.value (i.e. can be deleted). bool IsDbgValueKind = @@ -520,12 +520,12 @@ DbgVariableRecordsRemoveRedundantDbgInstrsUsingForwardScan(BasicBlock *BB) { // Update the map if we found a new value/expression describing the // variable, or if the variable wasn't mapped already. SmallVector<Value *, 4> Values(DVR.location_ops()); - if (VMI == VariableMap.end() || VMI->second.first != Values || + if (Inserted || VMI->second.first != Values || VMI->second.second != DVR.getExpression()) { if (IsDbgValueKind) - VariableMap[Key] = {Values, DVR.getExpression()}; + VMI->second = {Values, DVR.getExpression()}; else - VariableMap[Key] = {Values, nullptr}; + VMI->second = {Values, nullptr}; continue; } // Don't delete dbg.assign intrinsics that are linked to instructions. @@ -591,7 +591,7 @@ static bool removeRedundantDbgInstrsUsingForwardScan(BasicBlock *BB) { if (DbgValueInst *DVI = dyn_cast<DbgValueInst>(&I)) { DebugVariable Key(DVI->getVariable(), std::nullopt, DVI->getDebugLoc()->getInlinedAt()); - auto VMI = VariableMap.find(Key); + auto [VMI, Inserted] = VariableMap.try_emplace(Key); auto *DAI = dyn_cast<DbgAssignIntrinsic>(DVI); // A dbg.assign with no linked instructions can be treated like a // dbg.value (i.e. can be deleted). @@ -600,15 +600,15 @@ static bool removeRedundantDbgInstrsUsingForwardScan(BasicBlock *BB) { // Update the map if we found a new value/expression describing the // variable, or if the variable wasn't mapped already. SmallVector<Value *, 4> Values(DVI->getValues()); - if (VMI == VariableMap.end() || VMI->second.first != Values || + if (Inserted || VMI->second.first != Values || VMI->second.second != DVI->getExpression()) { // Use a sentinel value (nullptr) for the DIExpression when we see a // linked dbg.assign so that the next debug intrinsic will never match // it (i.e. always treat linked dbg.assigns as if they're unique). if (IsDbgValueKind) - VariableMap[Key] = {Values, DVI->getExpression()}; + VMI->second = {Values, DVI->getExpression()}; else - VariableMap[Key] = {Values, nullptr}; + VMI->second = {Values, nullptr}; continue; } |