-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Scalar] Simplify code with *Map::operator[] (NFC) #112120
Merged
kazutakahirata
merged 1 commit into
llvm:main
from
kazutakahirata:cleanup_001_operator_sq_br_Scalar
Oct 13, 2024
Merged
[Scalar] Simplify code with *Map::operator[] (NFC) #112120
kazutakahirata
merged 1 commit into
llvm:main
from
kazutakahirata:cleanup_001_operator_sq_br_Scalar
Oct 13, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@llvm/pr-subscribers-llvm-transforms Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/112120.diff 2 Files Affected:
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) {
|
nikic
approved these changes
Oct 13, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
DanielCChen
pushed a commit
to DanielCChen/llvm-project
that referenced
this pull request
Oct 16, 2024
bricknerb
pushed a commit
to bricknerb/llvm-project
that referenced
this pull request
Oct 17, 2024
EricWF
pushed a commit
to efcs/llvm-project
that referenced
this pull request
Oct 22, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.