[clang] b86f1af - [clang] Remove profile available check for fsplit-machine-functions.

Snehasish Kumar via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 18 15:20:36 PDT 2020


Author: Snehasish Kumar
Date: 2020-09-18T15:08:00-07:00
New Revision: b86f1af423952d9f1dbe105b651b948ce0e1e8d0

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

LOG: [clang] Remove profile available check for fsplit-machine-functions.

Enforcing a profile available check in the driver does not work with
incremental LTO builds where the LTO backend invocation does not include
the profile flags. At this point the profiles have already been consumed
and the IR contains profile metadata. Instead we always pass through the
-fsplit-machine-functions flag on user request. The pass itself contains
a check to return early if no profile information is available.

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

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Clang.cpp
    clang/test/Driver/fsplit-machine-functions.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 67c17ee2cbb4..0c03a90b8566 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -4916,16 +4916,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
                                options::OPT_fno_split_machine_functions)) {
     // This codegen pass is only available on x86-elf targets.
     if (Triple.isX86() && Triple.isOSBinFormatELF()) {
-      if (A->getOption().matches(options::OPT_fsplit_machine_functions)) {
-        // If the flag is enabled but no profile information is available then
-        // emit a warning.
-        if (getLastProfileUseArg(Args) || getLastProfileSampleUseArg(Args)) {
-          A->render(Args, CmdArgs);
-        } else {
-          D.Diag(diag::warn_drv_diagnostics_hotness_requires_pgo)
-              << A->getAsString(Args);
-        }
-      }
+      if (A->getOption().matches(options::OPT_fsplit_machine_functions))
+        A->render(Args, CmdArgs);
     } else {
       D.Diag(diag::err_drv_unsupported_opt_for_target)
           << A->getAsString(Args) << TripleStr;

diff  --git a/clang/test/Driver/fsplit-machine-functions.c b/clang/test/Driver/fsplit-machine-functions.c
index e126e4d41edb..fc0bb31f0f2b 100644
--- a/clang/test/Driver/fsplit-machine-functions.c
+++ b/clang/test/Driver/fsplit-machine-functions.c
@@ -1,9 +1,8 @@
 // RUN: %clang -### -target x86_64 -fprofile-use=default.profdata -fsplit-machine-functions %s -c 2>&1 | FileCheck -check-prefix=CHECK-OPT %s
+// RUN: %clang -### -target x86_64 -fsplit-machine-functions %s -c 2>&1 | FileCheck -check-prefix=CHECK-OPT %s
 // RUN: %clang -### -target x86_64 -fprofile-use=default.profdata -fsplit-machine-functions -fno-split-machine-functions %s -c 2>&1 | FileCheck -check-prefix=CHECK-NOOPT %s
-// RUN: %clang -### -target x86_64 -fsplit-machine-functions %s 2>&1 | FileCheck -check-prefix=CHECK-WARN %s
 // RUN: not %clang -c -target arm-unknown-linux -fsplit-machine-functions %s 2>&1 | FileCheck -check-prefix=CHECK-TRIPLE %s
 
 // CHECK-OPT:       "-fsplit-machine-functions"
 // CHECK-NOOPT-NOT: "-fsplit-machine-functions"
-// CHECK-WARN:      warning: argument '-fsplit-machine-functions' requires profile-guided optimization information
 // CHECK-TRIPLE:    error: unsupported option '-fsplit-machine-functions' for target


        


More information about the cfe-commits mailing list