[llvm] [SampleFDO] Support enabling sample loader pass in O0 mode (PR #113985)
Lei Wang via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 1 20:01:19 PDT 2024
================
@@ -103,3 +104,10 @@ declare i32 @printf(ptr, ...)
; MERGE: !{!"branch_weights", i32 10}
; MERGE: name: "sub"
; MERGE-NEXT: {!"function_entry_count", i64 3}
+
+; FLATTEN: name: "sum"
+; FLATTEN-NEXT: {!"function_entry_count", i64 35}
+; FLATTEN: !{!"branch_weights", i32 13, i32 23}
+; FLATTEN: !{!"branch_weights", i32 12}
----------------
wlei-llvm wrote:
OK, after switch using flattened profile, it triggered a test failure, I took a deep look at this, the reason might explain the difference using flattened profile vs merging not inlined profile on-the-fly(merged profile):
Original profile (two sum are in different context)
```
...
sum:46
2:10 sub:10
...
sum:11:22
2: sub:2
1: 2
```
The merged profile:
```
sum:46
2:10 sub:10
...
2: sub:2
1: 2
```
For a flattened profile
```
sum:46
2:12 sub:12
```
Then for the line 2, it gives different block count 12 vs 10, because the inlinee profile isn't counted for the block count, which I think it should be, so this seems using flattened profile makes more sense(though the difference is not big)
https://github.com/llvm/llvm-project/pull/113985
More information about the llvm-commits
mailing list