[all-commits] [llvm/llvm-project] e3eb40: Reland "[sancov][LoongArch] Resolve pcaddu18i+jirl...

ZhaoQi via All-commits all-commits at lists.llvm.org
Thu Aug 28 20:46:38 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e3eb4077a0fc80582d50dffe38ee47dfadc9cc19
      https://github.com/llvm/llvm-project/commit/e3eb4077a0fc80582d50dffe38ee47dfadc9cc19
  Author: ZhaoQi <zhaoqi01 at loongson.cn>
  Date:   2025-08-29 (Fri, 29 Aug 2025)

  Changed paths:
    M lld/test/ELF/loongarch-call36.s
    M llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCTargetDesc.cpp
    M llvm/tools/sancov/sancov.cpp

  Log Message:
  -----------
  Reland "[sancov][LoongArch] Resolve pcaddu18i+jirl in evaluateBranch and teach sancov (#155371)" (#155964)

Reland 9c994f5 after fixing ubsan bots failures.

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.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list