[compiler-rt] [llvm] [PGO] Add option to always instrumenting loop entries (PR #116789)

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 17:15:21 PST 2024


================
@@ -0,0 +1,106 @@
+; RUN: rm -rf %t && split-file %s %t
+
+; RUN: llvm-profdata merge %t/default.proftext -o %t/default.profdata
+; RUN: opt %t/main.ll -passes=pgo-instr-use -pgo-instrument-loop-entries=false -pgo-test-profile-file=%t/default.profdata -S | FileCheck %s
+; RUN: llvm-profdata merge %t/loop_entries.proftext -o %t/loop_entries.profdata
+; RUN: opt %t/main.ll -passes=pgo-instr-use -pgo-instrument-loop-entries=true -pgo-test-profile-file=%t/loop_entries.profdata -S | FileCheck %s
+; RUN: llvm-profdata merge %t/function_entry.proftext -o %t/function_entry.profdata
+; RUN: opt %t/main.ll -passes=pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t/function_entry.profdata -S | FileCheck %s
----------------
ellishg wrote:

You do not need to specify the flags when consuming profile because that info in encoded in the header.

```suggestion
; RUN: opt %t/main.ll -passes=pgo-instr-use -pgo-test-profile-file=%t/default.profdata -S | FileCheck %s
; RUN: llvm-profdata merge %t/loop_entries.proftext -o %t/loop_entries.profdata
; RUN: opt %t/main.ll -passes=pgo-instr-use -pgo-test-profile-file=%t/loop_entries.profdata -S | FileCheck %s
; RUN: llvm-profdata merge %t/function_entry.proftext -o %t/function_entry.profdata
; RUN: opt %t/main.ll -passes=pgo-instr-use -pgo-test-profile-file=%t/function_entry.profdata -S | FileCheck %s
```

https://github.com/llvm/llvm-project/pull/116789


More information about the llvm-commits mailing list