[llvm-branch-commits] [llvm] dffee4d - Revert "[NewPM] Add pass options for `InternalizePass` to preserve GVs. (#91334)"
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed May 15 15:05:07 PDT 2024
Author: Mehdi Amini
Date: 2024-05-15T15:05:04-07:00
New Revision: dffee4d14dc6c6dad97b060ea748116bd1c85d4b
URL: https://github.com/llvm/llvm-project/commit/dffee4d14dc6c6dad97b060ea748116bd1c85d4b
DIFF: https://github.com/llvm/llvm-project/commit/dffee4d14dc6c6dad97b060ea748116bd1c85d4b.diff
LOG: Revert "[NewPM] Add pass options for `InternalizePass` to preserve GVs. (#91334)"
This reverts commit ee765b0c94df7e636d9739216b1646d3a2d3b5db.
Added:
Modified:
llvm/lib/Passes/PassBuilder.cpp
llvm/lib/Passes/PassRegistry.def
llvm/test/Transforms/Internalize/lists.ll
Removed:
################################################################################
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index 91c5b65c03511..e4131706aba01 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -1142,24 +1142,6 @@ Expected<GlobalMergeOptions> parseGlobalMergeOptions(StringRef Params) {
return Result;
}
-Expected<SmallVector<std::string, 0>> parseInternalizeGVs(StringRef Params) {
- SmallVector<std::string, 1> PreservedGVs;
- while (!Params.empty()) {
- StringRef ParamName;
- std::tie(ParamName, Params) = Params.split(';');
-
- if (ParamName.consume_front("preserve-gv=")) {
- PreservedGVs.push_back(ParamName.str());
- } else {
- return make_error<StringError>(
- formatv("invalid Internalize pass parameter '{0}' ", ParamName).str(),
- inconvertibleErrorCode());
- }
- }
-
- return PreservedGVs;
-}
-
} // namespace
/// Tests whether a pass name starts with a valid prefix for a default pipeline
diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index 50682ca4970f1..e5ce6cb7da649 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -78,6 +78,7 @@ MODULE_PASS("insert-gcov-profiling", GCOVProfilerPass())
MODULE_PASS("instrorderfile", InstrOrderFilePass())
MODULE_PASS("instrprof", InstrProfilingLoweringPass())
MODULE_PASS("ctx-instr-lower", PGOCtxProfLoweringPass())
+MODULE_PASS("internalize", InternalizePass())
MODULE_PASS("invalidate<all>", InvalidateAllAnalysesPass())
MODULE_PASS("iroutliner", IROutlinerPass())
MODULE_PASS("jmc-instrumenter", JMCInstrumenterPass())
@@ -174,20 +175,6 @@ MODULE_PASS_WITH_PARAMS(
"hwasan", "HWAddressSanitizerPass",
[](HWAddressSanitizerOptions Opts) { return HWAddressSanitizerPass(Opts); },
parseHWASanPassOptions, "kernel;recover")
-MODULE_PASS_WITH_PARAMS(
- "internalize", "InternalizePass",
- [](SmallVector<std::string, 0> PreservedGVs) {
- if (PreservedGVs.empty())
- return InternalizePass();
- auto MustPreserveGV = [=](const GlobalValue &GV) {
- for (auto &PreservedGV : PreservedGVs)
- if (GV.getName() == PreservedGV)
- return true;
- return false;
- };
- return InternalizePass(MustPreserveGV);
- },
- parseInternalizeGVs, "preserve-gv=GV")
MODULE_PASS_WITH_PARAMS(
"ipsccp", "IPSCCPPass", [](IPSCCPOptions Opts) { return IPSCCPPass(Opts); },
parseIPSCCPOptions, "no-func-spec;func-spec")
diff --git a/llvm/test/Transforms/Internalize/lists.ll b/llvm/test/Transforms/Internalize/lists.ll
index 83dad03d75eae..df408f906b780 100644
--- a/llvm/test/Transforms/Internalize/lists.ll
+++ b/llvm/test/Transforms/Internalize/lists.ll
@@ -13,11 +13,6 @@
; -file and -list options should be merged, the apifile contains foo and j
; RUN: opt < %s -passes=internalize -internalize-public-api-list bar -internalize-public-api-file %S/apifile -S | FileCheck --check-prefix=FOO_J_AND_BAR %s
-; specifying through pass builder option
-; RUN: opt < %s -passes='internalize<preserve-gv=foo;preserve-gv=j>' -S | FileCheck --check-prefix=FOO_AND_J %s
-; RUN: opt < %s -passes='internalize<preserve-gv=foo;preserve-gv=bar>' -S | FileCheck --check-prefix=FOO_AND_BAR %s
-; RUN: opt < %s -passes='internalize<preserve-gv=foo;preserve-gv=j;preserve-gv=bar>' -S | FileCheck --check-prefix=FOO_J_AND_BAR %s
-
; ALL: @i = internal global
; FOO_AND_J: @i = internal global
; FOO_AND_BAR: @i = internal global
More information about the llvm-branch-commits
mailing list