aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
diff options
context:
space:
mode:
authorHongtao Yu <hoy@fb.com>2021-05-16 23:13:39 -0700
committerHongtao Yu <hoy@fb.com>2021-05-19 09:12:24 -0700
commit4ca6e37b9825db6d27a0aa2311b6530ac3faf021 (patch)
treee9873ab5ca1a0b47fff0f24efa4f035041fdf256 /llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
parent517857421d2ffcebc20da2c68862f7a2ddebaa51 (diff)
downloadllvm-4ca6e37b9825db6d27a0aa2311b6530ac3faf021.zip
llvm-4ca6e37b9825db6d27a0aa2311b6530ac3faf021.tar.gz
llvm-4ca6e37b9825db6d27a0aa2311b6530ac3faf021.tar.bz2
[CSSPGO] Overwrite branch weight annotated in previous pass.
Sample profile loader can be run in both LTO prelink and postlink. Currently the counts annoation in postilnk doesn't fully overwrite what's done in prelink. I'm adding a switch (`-overwrite-existing-weights=1`) to enable a full overwrite, which includes: 1. Clear old metadata for calls when their parent block has a zero count. This could be caused by prelink code duplication. 2. Clear indirect call metadata if somehow all the rest targets have a sum of zero count. 3. Overwrite branch weight for basic blocks. With a CS profile, I was seeing #1 and #2 help reduce code size by preventing post-sample ICP and CGSCC inliner working on obsolete metadata, which come from a partial global inlining in prelink. It's not expected to work well for non-CS case with a less-accurate post-inline count quality. It's worth calling out that some prelink optimizations can damage counts quality in an irreversible way. One example is the loop rotate optimization. Due to lack of exact loop entry count (profiling can only give loop iteration count and loop exit count), moving one iteration out of the loop body leaves the rest iteration count unknown. We had to turn off prelink loop rotate to achieve a better postlink counts quality. A even better postlink counts quality can be archived by turning off prelink CGSCC inlining which is not context-sensitive. Reviewed By: wenlei, wmi Differential Revision: https://reviews.llvm.org/D102537
Diffstat (limited to 'llvm/lib/ProfileData/Coverage/CoverageMapping.cpp')
0 files changed, 0 insertions, 0 deletions