[clang] 5fc1261 - [Driver] Remove -fno-experimental-new-pass-manager

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 28 14:58:31 PST 2022


Author: Fangrui Song
Date: 2022-01-28T14:58:26-08:00
New Revision: 5fc1261ef37549484e9eb9edc90477d713d8223f

URL: https://github.com/llvm/llvm-project/commit/5fc1261ef37549484e9eb9edc90477d713d8223f
DIFF: https://github.com/llvm/llvm-project/commit/5fc1261ef37549484e9eb9edc90477d713d8223f.diff

LOG: [Driver] Remove -fno-experimental-new-pass-manager

to give users a final warning that they need to migrate away. They could still
use -flegacy-pass-manager for Clang 14.0.0, but the functionality may not work
for 15.0.0.

-fexperimental-new-pass-manager is a no-op for default builds, so not urgent to
be removed for 14.0.0.

clang/test/Frontend/optimization-remark-with-hotness.c is removed because its
new PM replacement optimization-remark-with-hotness-new-pm.c exists.

Reviewed By: aeubanks, nikic

Differential Revision: https://reviews.llvm.org/D118313

Added: 
    

Modified: 
    clang/docs/ReleaseNotes.rst
    clang/include/clang/Driver/Options.td
    clang/test/Driver/flegacy-pass-manager.c

Removed: 
    clang/test/Frontend/optimization-remark-with-hotness.c


################################################################################
diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index aa54be1efe1c5..4b444bece68a7 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -107,7 +107,10 @@ Modified Compiler Flags
 Removed Compiler Flags
 -------------------------
 
-- ...
+- ``-fno-experimental-new-pass-manager`` has been removed.
+  ``-flegacy-pass-manager`` can be used as a makeshift,
+  Using the legacy pass manager for the optimization pipeline was deprecated in
+  13.0.0 and will be removed after 14.0.0.
 
 New Pragmas in Clang
 --------------------

diff  --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 52f05f392db2c..d3b309dfd5441 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1906,7 +1906,7 @@ defm legacy_pass_manager : BoolOption<"f", "legacy-pass-manager",
 def fexperimental_new_pass_manager : Flag<["-"], "fexperimental-new-pass-manager">,
   Group<f_clang_Group>, Flags<[CC1Option]>, Alias<fno_legacy_pass_manager>;
 def fno_experimental_new_pass_manager : Flag<["-"], "fno-experimental-new-pass-manager">,
-  Group<f_clang_Group>, Flags<[CC1Option]>, Alias<flegacy_pass_manager>;
+  Group<f_clang_Group>, Flags<[CC1Option,NoDriverOption]>, Alias<flegacy_pass_manager>;
 def fexperimental_strict_floating_point : Flag<["-"], "fexperimental-strict-floating-point">,
   Group<f_clang_Group>, Flags<[CC1Option]>,
   HelpText<"Enables experimental strict floating point in LLVM.">,

diff  --git a/clang/test/Driver/flegacy-pass-manager.c b/clang/test/Driver/flegacy-pass-manager.c
index 8ce2647ebc1df..2e45b5f6a1d07 100644
--- a/clang/test/Driver/flegacy-pass-manager.c
+++ b/clang/test/Driver/flegacy-pass-manager.c
@@ -1,9 +1,9 @@
 // RUN: %clang -### -c -flegacy-pass-manager -fno-legacy-pass-manager %s 2>&1 | FileCheck --check-prefixes=NOWARN,NEW %s
 // RUN: %clang -### -c -fno-legacy-pass-manager -flegacy-pass-manager %s 2>&1 | FileCheck --check-prefixes=NOWARN,LEGACY %s
 
-/// -f[no-]experimental-new-pass-manager are legacy aliases when the new PM was still experimental.
-// RUN: %clang -### -c -fno-experimental-new-pass-manager -fexperimental-new-pass-manager %s 2>&1 | FileCheck --check-prefixes=NOWARN,NEW %s
-// RUN: %clang -### -c -fexperimental-new-pass-manager -fno-experimental-new-pass-manager %s 2>&1 | FileCheck --check-prefixes=NOWARN,LEGACY %s
+/// -fexperimental-new-pass-manager is a legacy alias. -fno-experimental-new-pass-manager has been removed.
+// RUN: %clang -### -c -fexperimental-new-pass-manager %s 2>&1 | FileCheck --check-prefixes=NOWARN,NEW %s
+// RUN: not %clang -### -fno-experimental-new-pass-manager %s
 
 // NOWARN-NOT: warning: argument unused
 
@@ -20,7 +20,6 @@
 // LTO_NEW:    "-plugin-opt=new-pass-manager"
 
 // RUN: %clang -### -target x86_64-linux -flto -flegacy-pass-manager %s 2>&1 | FileCheck --check-prefix=LTO_LEGACY %s
-// RUN: %clang -### -target x86_64-linux -flto=thin -fno-experimental-new-pass-manager %s 2>&1 | FileCheck --check-prefix=LTO_LEGACY %s
 
 // LTO_LEGACY: "-plugin-opt=legacy-pass-manager"
 

diff  --git a/clang/test/Frontend/optimization-remark-with-hotness.c b/clang/test/Frontend/optimization-remark-with-hotness.c
deleted file mode 100644
index 43007b3f23303..0000000000000
--- a/clang/test/Frontend/optimization-remark-with-hotness.c
+++ /dev/null
@@ -1,78 +0,0 @@
-// Generate instrumentation and sampling profile data.
-// RUN: llvm-profdata merge \
-// RUN:     %S/Inputs/optimization-remark-with-hotness.proftext \
-// RUN:     -o %t.profdata
-// RUN: llvm-profdata merge -sample \
-// RUN:     %S/Inputs/optimization-remark-with-hotness-sample.proftext \
-// RUN:     -o %t-sample.profdata
-//
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
-// RUN:     optimization-remark-with-hotness.c %s -emit-llvm-only \
-// RUN:     -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
-// RUN:     -fno-experimental-new-pass-manager \
-// RUN:     -Rpass-analysis=inline -Rpass-missed=inline \
-// RUN:     -fdiagnostics-show-hotness -verify
-// The clang version of the previous test.
-// RUN: %clang -target x86_64-apple-macosx10.9 %s -c -emit-llvm -o /dev/null \
-// RUN:     -fprofile-instr-use=%t.profdata -Rpass=inline \
-// RUN:     -fno-experimental-new-pass-manager \
-// RUN:     -Rpass-analysis=inline -Rpass-missed=inline \
-// RUN:     -fdiagnostics-show-hotness -Xclang -verify
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
-// RUN:     optimization-remark-with-hotness.c %s -emit-llvm-only \
-// RUN:     -fprofile-sample-use=%t-sample.profdata -Rpass=inline \
-// RUN:     -fno-experimental-new-pass-manager \
-// RUN:     -Rpass-analysis=inline -Rpass-missed=inline \
-// RUN:     -fdiagnostics-show-hotness -fdiagnostics-hotness-threshold=10 \
-// RUN:     -verify
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
-// RUN:     optimization-remark-with-hotness.c %s -emit-llvm-only \
-// RUN:     -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
-// RUN:     -fno-experimental-new-pass-manager \
-// RUN:     -Rpass-analysis=inline -Rpass-missed=inline \
-// RUN:     -fdiagnostics-show-hotness -fdiagnostics-hotness-threshold=10 -verify
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
-// RUN:     optimization-remark-with-hotness.c %s -emit-llvm-only \
-// RUN:     -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
-// RUN:     -fno-experimental-new-pass-manager \
-// RUN:     -Rpass-analysis=inline 2>&1 | FileCheck -check-prefix=HOTNESS_OFF %s
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
-// RUN:     optimization-remark-with-hotness.c %s -emit-llvm-only \
-// RUN:     -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
-// RUN:     -fno-experimental-new-pass-manager \
-// RUN:     -Rpass-analysis=inline -Rno-pass-with-hotness 2>&1 | FileCheck \
-// RUN:     -check-prefix=HOTNESS_OFF %s
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
-// RUN:     optimization-remark-with-hotness.c %s -emit-llvm-only \
-// RUN:     -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
-// RUN:     -Rpass-analysis=inline -fdiagnostics-show-hotness \
-// RUN:     -fdiagnostics-hotness-threshold=100 2>&1 \
-// RUN:     | FileCheck -allow-empty -check-prefix=THRESHOLD %s
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
-// RUN:     optimization-remark-with-hotness.c %s -emit-llvm-only \
-// RUN:     -Rpass=inline -Rpass-analysis=inline \
-// RUN:     -fdiagnostics-show-hotness -fdiagnostics-hotness-threshold=10 2>&1 \
-// RUN:     | FileCheck -check-prefix=NO_PGO %s
-
-int foo(int x, int y) __attribute__((always_inline));
-int foo(int x, int y) { return x + y; }
-
-int sum = 0;
-
-void bar(int x) {
-  // HOTNESS_OFF: 'foo' inlined into 'bar'
-  // HOTNESS_OFF-NOT: hotness:
-  // THRESHOLD-NOT: inlined
-  // THRESHOLD-NOT: hotness
-  // NO_PGO: '-fdiagnostics-show-hotness' requires profile-guided optimization information
-  // NO_PGO: '-fdiagnostics-hotness-threshold=' requires profile-guided optimization information
-  // expected-remark at +1 {{'foo' inlined into 'bar' with (cost=always): always inliner at callsite bar:8:10; (hotness:}}
-  sum += foo(x, x - 2);
-}
-
-int main(int argc, const char *argv[]) {
-  for (int i = 0; i < 30; i++)
-    // expected-remark at +1 {{'bar' not inlined into 'main' because it should never be inlined (cost=never): no alwaysinline attribute (hotness:}}
-    bar(argc);
-  return sum;
-}


        


More information about the cfe-commits mailing list