[Mlir-commits] [clang] [flang] [mlir] [LLVM-Flang][Options] Add support for '-fprofile-sample-use' option (PR #188697)
Tarun Prabhu
llvmlistbot at llvm.org
Thu Mar 26 06:17:29 PDT 2026
================
@@ -0,0 +1,30 @@
+! Test to check the working of option "-fprofile-sample-use".
+
+! RUN: %flang -### -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s 2>&1 | FileCheck %s --check-prefix=PROFILE-SAMPLE-USE
+! RUN: %flang -### %s 2>&1 | FileCheck %s --check-prefix=NO-PROFILE-SAMPLE-USE
+! RUN: %flang -### -fprofile-sample-use=%S/Inputs/pgo-sample.prof -fno-profile-sample-use %s 2>&1 | FileCheck %s --check-prefix=NO-PROFILE-SAMPLE-USE
+! RUN: %flang -### -fno-profile-sample-use %s 2>&1 | FileCheck %s --check-prefix=NO-PROFILE-SAMPLE-USE
+! RUN: not %flang -fsyntax-only -fprofile-sample-use=%t/missing-profile.prof %s 2>&1 | FileCheck %s --check-prefix=PROFILE-SAMPLE-USE-NO-FILE
+! RUN: not %flang -fsyntax-only -fprofile-generate -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s 2>&1 | FileCheck %s --check-prefix=PROFILE-SAMPLE-USE-ERROR
----------------
tarunprabhu wrote:
Seriously big nit: This is just reorganizing the tests so they start with the default and proceeding from simple to more complex combinations of options. This made it easier to review, and, arguably, is easier to read when needed.
```suggestion
! RUN: %flang -### %s 2>&1 | FileCheck %s --check-prefix=NO-PROFILE-SAMPLE-USE
! RUN: %flang -### -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s 2>&1 | FileCheck %s --check-prefix=PROFILE-SAMPLE-USE
! RUN: %flang -### -fno-profile-sample-use %s 2>&1 | FileCheck %s --check-prefix=NO-PROFILE-SAMPLE-USE
! RUN: %flang -### -fprofile-sample-use=%S/Inputs/pgo-sample.prof -fno-profile-sample-use %s 2>&1 | FileCheck %s --check-prefix=NO-PROFILE-SAMPLE-USE
! RUN: not %flang -fsyntax-only -fprofile-sample-use=%t/missing-profile.prof %s 2>&1 | FileCheck %s --check-prefix=PROFILE-SAMPLE-USE-NO-FILE
! RUN: not %flang -fsyntax-only -fprofile-generate -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s 2>&1 | FileCheck %s --check-prefix=PROFILE-SAMPLE-USE-ERROR
```
https://github.com/llvm/llvm-project/pull/188697
More information about the Mlir-commits
mailing list