[llvm] d1620c1 - [Scalar] Simplify code with *Map::operator[] (NFC) (#112120)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 13 07:34:50 PDT 2024
Author: Kazu Hirata
Date: 2024-10-13T07:34:47-07:00
New Revision: d1620c1d8cf50e236272ef529301e0c80388ed39
URL: https://github.com/llvm/llvm-project/commit/d1620c1d8cf50e236272ef529301e0c80388ed39
DIFF: https://github.com/llvm/llvm-project/commit/d1620c1d8cf50e236272ef529301e0c80388ed39.diff
LOG: [Scalar] Simplify code with *Map::operator[] (NFC) (#112120)
Added:
Modified:
llvm/lib/Transforms/Scalar/AnnotationRemarks.cpp
llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/AnnotationRemarks.cpp b/llvm/lib/Transforms/Scalar/AnnotationRemarks.cpp
index 5d9a7bca7efeca..7f9129697995a0 100644
--- a/llvm/lib/Transforms/Scalar/AnnotationRemarks.cpp
+++ b/llvm/lib/Transforms/Scalar/AnnotationRemarks.cpp
@@ -52,8 +52,7 @@ static void runImpl(Function &F, const TargetLibraryInfo &TLI) {
for (Instruction &I : instructions(F)) {
if (!I.hasMetadata(LLVMContext::MD_annotation))
continue;
- auto Iter = DebugLoc2Annotated.insert({I.getDebugLoc().getAsMDNode(), {}});
- Iter.first->second.push_back(&I);
+ DebugLoc2Annotated[I.getDebugLoc().getAsMDNode()].push_back(&I);
for (const MDOperand &Op :
I.getMetadata(LLVMContext::MD_annotation)->operands()) {
@@ -62,8 +61,7 @@ static void runImpl(Function &F, const TargetLibraryInfo &TLI) {
? cast<MDString>(Op.get())->getString()
: cast<MDString>(cast<MDTuple>(Op.get())->getOperand(0).get())
->getString();
- auto Iter = Mapping.insert({AnnotationStr, 0});
- Iter.first->second++;
+ Mapping[AnnotationStr]++;
}
}
diff --git a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
index a4ab288b1bfee8..f2ea9f8faf84cd 100644
--- a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
+++ b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
@@ -2486,8 +2486,7 @@ class LowerMatrixIntrinsics {
if (!ExprsInSubprogram.count(V))
return;
- auto I = Shared.insert({V, {}});
- I.first->second.insert(Leaf);
+ Shared[V].insert(Leaf);
for (Value *Op : cast<Instruction>(V)->operand_values())
collectSharedInfo(Leaf, Op, ExprsInSubprogram, Shared);
@@ -2538,14 +2537,12 @@ class LowerMatrixIntrinsics {
auto *I = cast<Instruction>(KV.first);
DILocation *Context = I->getDebugLoc();
while (Context) {
- auto I =
- Subprog2Exprs.insert({getSubprogram(Context->getScope()), {}});
- I.first->second.push_back(KV.first);
+ Subprog2Exprs[getSubprogram(Context->getScope())].push_back(
+ KV.first);
Context = DebugLoc(Context).getInlinedAt();
}
} else {
- auto I = Subprog2Exprs.insert({nullptr, {}});
- I.first->second.push_back(KV.first);
+ Subprog2Exprs[nullptr].push_back(KV.first);
}
}
for (auto &KV : Subprog2Exprs) {
More information about the llvm-commits
mailing list