diff options
author | Kazu Hirata <kazu@google.com> | 2025-03-23 19:42:53 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-23 19:42:53 -0700 |
commit | 73dc2afd2c334aac735caba94292052d63014c9d (patch) | |
tree | 129d75db3156ceb1920e458f5ea913f2a53df27d /llvm/lib/Transforms/Utils/CloneFunction.cpp | |
parent | 943a70717c629f43b309ab56e8141ffb131871a6 (diff) | |
download | llvm-73dc2afd2c334aac735caba94292052d63014c9d.zip llvm-73dc2afd2c334aac735caba94292052d63014c9d.tar.gz llvm-73dc2afd2c334aac735caba94292052d63014c9d.tar.bz2 |
[Transforms] Use *Set::insert_range (NFC) (#132652)
We can use *Set::insert_range to collapse:
for (auto Elem : Range)
Set.insert(E);
down to:
Set.insert_range(Range);
In some cases, we can further fold that into the set declaration.
Diffstat (limited to 'llvm/lib/Transforms/Utils/CloneFunction.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/CloneFunction.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp index b411d4c..e585857 100644 --- a/llvm/lib/Transforms/Utils/CloneFunction.cpp +++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp @@ -313,9 +313,7 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc, auto *NewModule = NewFunc->getParent(); auto *NMD = NewModule->getOrInsertNamedMetadata("llvm.dbg.cu"); // Avoid multiple insertions of the same DICompileUnit to NMD. - SmallPtrSet<const void *, 8> Visited; - for (auto *Operand : NMD->operands()) - Visited.insert(Operand); + SmallPtrSet<const void *, 8> Visited(llvm::from_range, NMD->operands()); // Collect and clone all the compile units referenced from the instructions in // the function (e.g. as instructions' scope). |