diff options
author | ZhaoQi <zhaoqi01@loongson.cn> | 2025-08-28 09:25:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-28 09:25:30 +0800 |
commit | 9c994f54497b54d8c44d2c6979a4cdaa8e4d7833 (patch) | |
tree | 48ffe33b8c55c84b9f50d83e4e49d6d040cff523 /llvm/docs/RISCVUsage.rst | |
parent | 8e7385a8ea91d96f24af903d91ca7f7dd1daa24d (diff) | |
download | llvm-9c994f54497b54d8c44d2c6979a4cdaa8e4d7833.zip llvm-9c994f54497b54d8c44d2c6979a4cdaa8e4d7833.tar.gz llvm-9c994f54497b54d8c44d2c6979a4cdaa8e4d7833.tar.bz2 |
[sancov][LoongArch] Resolve pcaddu18i+jirl in evaluateBranch and teach sancov (#155371)
This commit overrides `updateState` and `resetState` hooks in
`MCInstrAnalysis` in order to be able to analyze pcaddu18i+jirl pairs
inside `evaluateBranch`.
After this commit, `llvm-objdump` is able to correctly analyze and print
detailed information. `lld/test/ELF/loongarch-call36.s` shows the
changes.
Besides, this commit also teaches sancov to resolve such call sequences.
Without this commit, some tests in compiler-rt failed:
```
Failed Tests :
SanitizerCommon-asan-loongarch64-Linux :: sanitizer_coverage_trace_pc_guard-dso.cpp
SanitizerCommon-asan-loongarch64-Linux :: sanitizer_coverage_trace_pc_guard.cpp
SanitizerCommon-lsan-loongarch64-Linux :: sanitizer_coverage_trace_pc_guard-dso.cpp
SanitizerCommon-lsan-loongarch64-Linux :: sanitizer_coverage_trace_pc_guard.cpp
SanitizerCommon-msan-loongarch64-Linux :: sanitizer_coverage_trace_pc_guard-dso.cpp
SanitizerCommon-msan-loongarch64-Linux :: sanitizer_coverage_trace_pc_guard.cpp
```
The reason is that sancov could not resolve pcaddu18i+jirl call sequence
correctly and caused mismatches between coverage points in the binary
and the .sancov file:
```
ERROR: Coverage points in binary and .sancov file do not match.
```
NOTE: A similar issue might also occur on RISC-V when relaxation is
disabled (not verified). This commit can also fix for it.
Diffstat (limited to 'llvm/docs/RISCVUsage.rst')
0 files changed, 0 insertions, 0 deletions