[llvm-dev] What can the optimizer assume about the memory a global function pointer points to?

Manuel Jacob via llvm-dev llvm-dev at lists.llvm.org
Thu Apr 16 11:46:54 PDT 2020

On 2020-04-16 18:26, Hiroshi Yamauchi wrote:
> I am not sure if the IR spec that explicitly talks about this, but I'm
> under the impression that the code memory is assumed to be constant or
> abstracted out at the IR level and the IR optimizer does not need to 
> think
> about the code getting modified or just treats it as undefined 
> behavior.

One case where the Language Reference explicitly mentions the 
possibility of modifying machine code is Prologue Data: 

So at least the prologue part is seemingly not considered constant. The 
question of what ordering restrictions are placed between calls and code 
potentially modifying the callee machine code is still unclear, though.

More information about the llvm-dev mailing list