| Issue |
237991
|
| Summary |
[AArch64] Redundant pointer reload at a merge of successful and helper-call paths
|
| Labels |
|
| Assignees |
|
| Reporter |
bagrorg
|
Clang stores an updated pointer, then reloads it alongside the input-buffer pointer at a shared block. The reload is needed after an opaque helper call, but the successful path already has both pointers in registers. GCC reuses the available pointer on that path.
[Reproducer on Compiler Explorer](https://godbolt.org/z/e9Tz67n68): includes C++ source and **original and patched Clang-generated assembly**. The patched assembly follows GCC’s pointer reuse, retaining the reload only on the helper-return path.
Tested configuration:
- **Clang:** 24.0.0git, LLVM `cd3be30dcbabdf92067782b62dd5f3d995fd5d23`
- **GCC:** 16.0.1 20260322, `r16-8246-g569ace1fa50`
- **Hardware/OS:** Neoverse V3, Linux AArch64
- **Flags:** `-O3 -DNDEBUG -std=c++17 -mcpu=neoverse-v3`
Measurements:
| Clang — original assembly | Clang — patched assembly | GCC |
|---:|---:|---:|
| 7.4447 ns/record | 5.6370 ns/record | 3.7077 ns/record |
Originally observed in [simdjson’s scalar conversion](https://github.com/simdjson/simdjson/blob/3b2870d822b1797cfebb368cd76df0413a7016bb/include/simdjson/generic/ondemand/value_iterator-inl.h#L602-L606), revision `3b2870d822b1797cfebb368cd76df0413a7016bb`.
The corresponding broader state-forwarding patches reduced elapsed time by **1.12–1.97%** in simdjson benchmarks; this reproducer isolates the pointer-reload part.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs