-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[llvm] Use *Set::insert_range (NFC) #138237
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
Open
kazutakahirata
wants to merge
1
commit into
llvm:main
Choose a base branch
from
kazutakahirata:cleanup_001_range_insert_range
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[llvm] Use *Set::insert_range (NFC) #138237
kazutakahirata
wants to merge
1
commit into
llvm:main
from
kazutakahirata:cleanup_001_range_insert_range
Conversation
This file contains hidden or 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-backend-risc-v @llvm/pr-subscribers-llvm-transforms Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/138237.diff 5 Files Affected:
diff --git a/llvm/lib/CodeGen/LexicalScopes.cpp b/llvm/lib/CodeGen/LexicalScopes.cpp
index 6dbd2ca00f316..5916f619537a4 100644
--- a/llvm/lib/CodeGen/LexicalScopes.cpp
+++ b/llvm/lib/CodeGen/LexicalScopes.cpp
@@ -287,8 +287,7 @@ void LexicalScopes::getMachineBasicBlocks(
return;
if (Scope == CurrentFnLexicalScope) {
- for (const auto &MBB : *MF)
- MBBs.insert(&MBB);
+ MBBs.insert_range(llvm::make_pointer_range(*MF));
return;
}
diff --git a/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp b/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
index 9ed2ba274bc53..4bc040002ebd7 100644
--- a/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
+++ b/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
@@ -1336,8 +1336,8 @@ RISCVVLOptimizer::checkUsers(const MachineInstr &MI) const {
UserMI.getOperand(0).getSubReg() == RISCV::NoSubRegister &&
UserMI.getOperand(1).getSubReg() == RISCV::NoSubRegister) {
LLVM_DEBUG(dbgs() << " Peeking through uses of COPY\n");
- for (auto &CopyUse : MRI->use_operands(UserMI.getOperand(0).getReg()))
- Worklist.insert(&CopyUse);
+ Worklist.insert_range(llvm::make_pointer_range(
+ MRI->use_operands(UserMI.getOperand(0).getReg())));
continue;
}
@@ -1346,8 +1346,8 @@ RISCVVLOptimizer::checkUsers(const MachineInstr &MI) const {
if (!PHISeen.insert(&UserMI).second)
continue;
LLVM_DEBUG(dbgs() << " Peeking through uses of PHI\n");
- for (auto &PhiUse : MRI->use_operands(UserMI.getOperand(0).getReg()))
- Worklist.insert(&PhiUse);
+ Worklist.insert_range(llvm::make_pointer_range(
+ MRI->use_operands(UserMI.getOperand(0).getReg())));
continue;
}
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index a72c1d329e199..8982e9971efbc 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -626,8 +626,7 @@ static void followUsesInContext(AAType &AA, Attributor &A,
if (const Instruction *UserI = dyn_cast<Instruction>(U->getUser())) {
bool Found = Explorer.findInContextOf(UserI, EIt, EEnd);
if (Found && AA.followUseInMBEC(A, U, UserI, State))
- for (const Use &Us : UserI->uses())
- Uses.insert(&Us);
+ Uses.insert_range(llvm::make_pointer_range(UserI->uses()));
}
}
}
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 8094697cdd13a..d9aa6db86e930 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -7547,8 +7547,7 @@ bool SimplifyCFGOpt::simplifyDuplicateSwitchArms(SwitchInst *SI,
if (Seen.insert(BB).second) {
// Keep track of which PHIs we need as keys in PhiPredIVs below.
for (BasicBlock *Succ : BI->successors())
- for (PHINode &Phi : Succ->phis())
- Phis.insert(&Phi);
+ Phis.insert_range(llvm::make_pointer_range(Succ->phis()));
// Add the successor only if not previously visited.
Cases.emplace_back(SwitchSuccWrapper{BB, &PhiPredIVs});
}
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.cpp b/llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.cpp
index 2eff3da263d31..3d5c3262dc53e 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceOperandsSkip.cpp
@@ -151,8 +151,7 @@ opportunities(Function &F,
// Regardless whether referenced, add the function arguments as
// replacement possibility with the goal of reducing the number of (used)
// function arguments, possibly created by the operands-to-args.
- for (Argument &Arg : F.args())
- ReferencedVals.insert(&Arg);
+ ReferencedVals.insert_range(llvm::make_pointer_range(F.args()));
// After all candidates have been added, it doesn't need to be a set
// anymore.
|
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.