[llvm] [NFC][LLVM] Code cleanup in InstructionNamer.cpp (PR #162689)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 9 09:50:40 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Rahul Joshi (jurahul)

<details>
<summary>Changes</summary>

Make file local function static and use explicit type for Arg.

---
Full diff: https://github.com/llvm/llvm-project/pull/162689.diff


1 Files Affected:

- (modified) llvm/lib/Transforms/Utils/InstructionNamer.cpp (+2-5) 


``````````diff
diff --git a/llvm/lib/Transforms/Utils/InstructionNamer.cpp b/llvm/lib/Transforms/Utils/InstructionNamer.cpp
index 3ae570cfeb776..4f1ff7bcacdeb 100644
--- a/llvm/lib/Transforms/Utils/InstructionNamer.cpp
+++ b/llvm/lib/Transforms/Utils/InstructionNamer.cpp
@@ -20,9 +20,8 @@
 
 using namespace llvm;
 
-namespace {
-void nameInstructions(Function &F) {
-  for (auto &Arg : F.args()) {
+static void nameInstructions(Function &F) {
+  for (Argument &Arg : F.args()) {
     if (!Arg.hasName())
       Arg.setName("arg");
   }
@@ -38,8 +37,6 @@ void nameInstructions(Function &F) {
   }
 }
 
-} // namespace
-
 PreservedAnalyses InstructionNamerPass::run(Function &F,
                                             FunctionAnalysisManager &FAM) {
   nameInstructions(F);

``````````

</details>


https://github.com/llvm/llvm-project/pull/162689


More information about the llvm-commits mailing list