I am building and inserting a function call in IR, but one of my
parameters needs to the address of the current stack address ($RSP).
Also add in that I have LTO inlining this small function call.
My patch worked when we did not have inlining of the function. Just replaced
MOV64ri $RDI, 0x0 with
MOV64rr $RDI, $RSP to set parameter 0 to the stack addr.
With inlining, I currently then have tried to "patch" the UndefValue
to be $RSP except it seems LTO is optimizing out the UndefValue
parameter, so patching via a machine function pass isnt working out.
Question: Where in LLVM code (I assume somewhere in lowering stage,
but would appreciate a little more guidance here) can I update the
function parameter/operand from the undefValue it is via IR level to
be $RSP once LLVM knows we are working with an X86 target??
Thank you in advance,
Graduate Research Assistant