[PATCH] D87943: [clang] Remove profile availabile check for fsplit-machine-functions.

Snehasish Kumar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 18 14:13:52 PDT 2020


snehasish created this revision.
snehasish added reviewers: tejohnson, davidxl.
Herald added subscribers: cfe-commits, dexonsmith.
Herald added a project: clang.
snehasish requested review of this revision.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87943

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


Index: clang/test/Driver/fsplit-machine-functions.c
===================================================================
--- clang/test/Driver/fsplit-machine-functions.c
+++ clang/test/Driver/fsplit-machine-functions.c
@@ -1,9 +1,7 @@
 // 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 -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
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -4917,14 +4917,7 @@
     // 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);
-        }
       }
     } else {
       D.Diag(diag::err_drv_unsupported_opt_for_target)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87943.292897.patch
Type: text/x-patch
Size: 1943 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200918/ff1e6d12/attachment.bin>


More information about the cfe-commits mailing list