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

Pengcheng Wang via llvm-commits llvm-commits at lists.llvm.org
Thu May 30 21:16:42 PDT 2024


wangpc-pp wrote:

> > Just FYI, we have implemented `__clear_cache` via calling `__NR_riscv_flush_icache` in `compiler-rt`:
> 
> Thanks for the update. Do you use `compiler-rt` even on glibc targets?

No I don't use `compiler-rt` on glibc. 

> Not sure if there is a way to know we're on a glibc target **and** we are using `libgcc` for the compiler runtime (which would indeed have to call `__riscv_flush_icache`).

We can know it in Clang via the `RuntimeLibType` we use, but I think this information won't be passed to LLVM's CodeGen part.

Maybe another way to fix this issue is implementing `__clear_cache` in libgcc. cc @kito-cheng 

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


More information about the llvm-commits mailing list