[llvm] [llvm] Use llvm::transform (NFC) (PR #137532)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 27 10:04:29 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/137532

None

>From 885dcf7ad8139d2ad5518053e064c2f8e9e3e583 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 27 Apr 2025 09:16:58 -0700
Subject: [PATCH] [llvm] Use llvm::transform (NFC)

---
 llvm/include/llvm/TableGen/DirectiveEmitter.h              | 2 +-
 llvm/lib/DebugInfo/LogicalView/Core/LVSupport.cpp          | 4 ++--
 .../lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp | 4 ++--
 .../WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp      | 4 ++--
 llvm/lib/Transforms/Scalar/NewGVN.cpp                      | 7 +++----
 5 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/llvm/include/llvm/TableGen/DirectiveEmitter.h b/llvm/include/llvm/TableGen/DirectiveEmitter.h
index b856bb77f7b74..4b21ad6342b59 100644
--- a/llvm/include/llvm/TableGen/DirectiveEmitter.h
+++ b/llvm/include/llvm/TableGen/DirectiveEmitter.h
@@ -211,7 +211,7 @@ class Clause : public BaseRecord {
     StringRef Name = Def->getValueAsString("name");
     std::string N = Name.str();
     bool Cap = true;
-    std::transform(N.begin(), N.end(), N.begin(), [&Cap](unsigned char C) {
+    llvm::transform(N, N.begin(), [&Cap](unsigned char C) {
       if (Cap == true) {
         C = toUpper(C);
         Cap = false;
diff --git a/llvm/lib/DebugInfo/LogicalView/Core/LVSupport.cpp b/llvm/lib/DebugInfo/LogicalView/Core/LVSupport.cpp
index da6ba8dfd483b..d22b136632148 100644
--- a/llvm/lib/DebugInfo/LogicalView/Core/LVSupport.cpp
+++ b/llvm/lib/DebugInfo/LogicalView/Core/LVSupport.cpp
@@ -30,7 +30,7 @@ LVStringPool &llvm::logicalview::getStringPool() { return StringPool; }
 // - '//' into '/'
 std::string llvm::logicalview::transformPath(StringRef Path) {
   std::string Name(Path);
-  std::transform(Name.begin(), Name.end(), Name.begin(), tolower);
+  llvm::transform(Name, Name.begin(), tolower);
   llvm::replace(Name, '\\', '/');
 
   // Remove all duplicate slashes.
@@ -47,7 +47,7 @@ std::string llvm::logicalview::transformPath(StringRef Path) {
 //   '/', '\', '<', '>', '.', ':', '%', '*', '?', '|', '"', ' '.
 std::string llvm::logicalview::flattenedFilePath(StringRef Path) {
   std::string Name(Path);
-  std::transform(Name.begin(), Name.end(), Name.begin(), tolower);
+  llvm::transform(Name, Name.begin(), tolower);
 
   const char *CharSet = "/\\<>.:%*?|\" ";
   char *Input = Name.data();
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
index 875b505549f0a..5552cea78694d 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
@@ -1018,7 +1018,7 @@ bool AArch64InstPrinter::printSysAlias(const MCInst *MI,
     return false;
 
   std::string Str = Ins + Name;
-  std::transform(Str.begin(), Str.end(), Str.begin(), ::tolower);
+  llvm::transform(Str, Str.begin(), ::tolower);
 
   O << '\t' << Str;
   if (NeedsReg) {
@@ -1077,7 +1077,7 @@ bool AArch64InstPrinter::printSyspAlias(const MCInst *MI,
     return false;
 
   std::string Str = Ins + Name;
-  std::transform(Str.begin(), Str.end(), Str.begin(), ::tolower);
+  llvm::transform(Str, Str.begin(), ::tolower);
 
   O << '\t' << Str;
   O << ", ";
diff --git a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp
index 68b24dbe9f006..c0729cb4f3e9b 100644
--- a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp
+++ b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp
@@ -126,8 +126,8 @@ SmallVector<WebAssemblyAsmTypeCheck::StackType, 4>
 WebAssemblyAsmTypeCheck::valTypesToStackTypes(
     ArrayRef<wasm::ValType> ValTypes) {
   SmallVector<StackType, 4> Types(ValTypes.size());
-  std::transform(ValTypes.begin(), ValTypes.end(), Types.begin(),
-                 [](wasm::ValType Val) -> StackType { return Val; });
+  llvm::transform(ValTypes, Types.begin(),
+                  [](wasm::ValType Val) -> StackType { return Val; });
   return Types;
 }
 
diff --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp
index d06796660c444..d5fbbf0c10011 100644
--- a/llvm/lib/Transforms/Scalar/NewGVN.cpp
+++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp
@@ -1074,10 +1074,9 @@ PHIExpression *NewGVN::createPHIExpression(ArrayRef<ValPair> PHIOperands,
     HasBackedge = HasBackedge || isBackedge(BB, PHIBlock);
     return lookupOperandLeader(P.first) != I;
   });
-  std::transform(Filtered.begin(), Filtered.end(), op_inserter(E),
-                 [&](const ValPair &P) -> Value * {
-                   return lookupOperandLeader(P.first);
-                 });
+  llvm::transform(Filtered, op_inserter(E), [&](const ValPair &P) -> Value * {
+    return lookupOperandLeader(P.first);
+  });
   return E;
 }
 



More information about the llvm-commits mailing list