-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[llvm] Use llvm::transform (NFC) #137532
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
Merged
kazutakahirata
merged 1 commit into
llvm:main
from
kazutakahirata:cleanup_001_range_llvm_transform
Apr 27, 2025
Merged
[llvm] Use llvm::transform (NFC) #137532
kazutakahirata
merged 1 commit into
llvm:main
from
kazutakahirata:cleanup_001_range_llvm_transform
Apr 27, 2025
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-debuginfo @llvm/pr-subscribers-llvm-transforms Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/137532.diff 5 Files Affected:
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;
}
|
@llvm/pr-subscribers-backend-aarch64 Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/137532.diff 5 Files Affected:
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;
}
|
kuhar
approved these changes
Apr 27, 2025
jyli0116
pushed a commit
to jyli0116/llvm-project
that referenced
this pull request
Apr 28, 2025
IanWood1
pushed a commit
to IanWood1/llvm-project
that referenced
this pull request
May 6, 2025
IanWood1
pushed a commit
to IanWood1/llvm-project
that referenced
this pull request
May 6, 2025
IanWood1
pushed a commit
to IanWood1/llvm-project
that referenced
this pull request
May 6, 2025
Ankur-0429
pushed a commit
to Ankur-0429/llvm-project
that referenced
this pull request
May 9, 2025
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.