Instruction Prefetching in llvm


Has anyone ever implemented instruction prefetching with llvm? If so, on which architectures?

Grep prefetch in lib/Target/* will show you ARM, X86, and PPC seems
have implemented prefetch instruction. LLVM provides prefetch intrinsic
[1] so that you can insert it in LLVM IR as a hint to code generator.
I guess you need to write a pass to lower the intrinsic call to your
target code.



Hi Chenwj,

The prefetch intrinsic in llvm seems to be useful for only data prefetching i.e data into d-cache. When I try to prefetch instructions into i-cache, it does not work. Would you know anything about how to resolve this issue?