Author: Nilanjana Basu
Date: 2025-07-09T14:53:28-07:00
New Revision: 2fc4a4a9d3a87a9e11c48ef25522aa17c2a71003

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

LOG: [Driver][SamplePGO] Enable -fsample-profile-use-profi (#146795)

Since profile inference improves sample coverage, it should be turned on by 
default.

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Clang.cpp
    clang/test/Driver/pgo-sample-use-profi.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 0dbe46319247b..b76163afc8aa4 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6265,7 +6265,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction 
&JA,
 
   if (getLastProfileSampleUseArg(Args) &&
       Args.hasFlag(options::OPT_fsample_profile_use_profi,
-                   options::OPT_fno_sample_profile_use_profi, false)) {
+                   options::OPT_fno_sample_profile_use_profi, true)) {
     CmdArgs.push_back("-mllvm");
     CmdArgs.push_back("-sample-profile-use-profi");
   }

diff  --git a/clang/test/Driver/pgo-sample-use-profi.c 
b/clang/test/Driver/pgo-sample-use-profi.c
index aef00724f8687..dd504c20e23e5 100644
--- a/clang/test/Driver/pgo-sample-use-profi.c
+++ b/clang/test/Driver/pgo-sample-use-profi.c
@@ -1,11 +1,11 @@
 /// Test if profi flag is enabled/disabled correctly based on user-specified 
configuration.
-/// Ensure that profi flag is disabled by default
+/// Ensure that profi flag is enabled by default
 
-// RUN: %clang --target=x86_64 -c -fprofile-sample-use=/dev/null -### %s 2>&1 
| FileCheck %s --check-prefixes=CHECK-NO-PROFI
+// RUN: %clang --target=x86_64 -c -fprofile-sample-use=/dev/null -### %s 2>&1 
| FileCheck %s
 // RUN: %clang --target=x86_64 -c -fsample-profile-use-profi 
-fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s
 // RUN: %clang --target=x86_64 -c -fno-sample-profile-use-profi 
-fsample-profile-use-profi -fprofile-sample-use=/dev/null -### %s 2>&1 | 
FileCheck %s
 
-// RUN: %clang --target=AArch64 -c -fprofile-sample-use=/dev/null -### %s 2>&1 
| FileCheck %s --check-prefixes=CHECK-NO-PROFI
+// RUN: %clang --target=AArch64 -c -fprofile-sample-use=/dev/null -### %s 2>&1 
| FileCheck %s
 // RUN: %clang --target=AArch64 -c -fsample-profile-use-profi 
-fprofile-sample-use=/dev/null -### %s 2>&1 | FileCheck %s
 // RUN: %clang --target=AArch64 -c -fno-sample-profile-use-profi 
-fsample-profile-use-profi -fprofile-sample-use=/dev/null -### %s 2>&1 | 
FileCheck %s
 


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to