[llvm] [RISCV][SelectionDAG] Lower llvm.clear_cache to __riscv_flush_icache for glibc targets (PR #93481)

Pengcheng Wang via llvm-commits llvm-commits at lists.llvm.org
Mon May 27 22:22:14 PDT 2024


wangpc-pp wrote:

Just FYI, we have implemented `__clear_cache` via calling `__NR_riscv_flush_icache` in `compiler-rt`:
https://github.com/llvm/llvm-project/blob/5c7c1f6aba467b1c5a51d58fc591314ecd7147ce/compiler-rt/lib/builtins/clear_cache.c#L184-L194
So we can link it by specifying ` --rtlib=compiler-rt`.
For `libgcc`, `__clear_cache` does nothing.
For glibc's `__riscv_flush_icache` implementation, it just calls the `__NR_riscv_flush_icache` (the same as `compiler-rt`'s `__clear_cache` implementation), and there may be vDSO acceleration.

https://github.com/llvm/llvm-project/pull/93481


More information about the llvm-commits mailing list