[LLVMdev] Safe loads

Roman Leshchinskiy rl at cse.unsw.edu.au
Mon Jan 23 06:22:41 CST 2012


For the Glasgow Haskell Compiler's backend, we would like to let LLVM know
that certain loads are safe to execute speculatively and hence to hoist
out of loops. At the moment, there doesn't seem to be a mechanism for
doing so. There seem to be two ways of implementing this: either allow
arbitrary instructions to be marked as safe and have
Instruction::isSafeToSpeculativelyExecute return true for those or mark
memory regions and extend Value::isDereferenceablePointer to return true
for those. Is either of these a good idea? Or is there some other way to
do this? FWIW, I quickly prototyped instruction marking using metadata and
that seemed to work well enough for us.


More information about the LLVMdev mailing list