[LLVMdev] Help !! Problem about Intrinsic::returnaddress and optimization

Xueying ZHANG s1031770 at sms.ed.ac.uk
Sun Jul 31 04:29:00 PDT 2011

Hi all,

I want to add some functionalities to Stack protection of llvm by
modifying the file StackPrtoector.cpp under llvm/src/lib/CodeGen.
However, I encounter some problems here.

Here is my problem:

I want to call the function Intrinsic::returnaddress with the same
parameter twice in a function. However, llvm will optimize this
process automatically by storing the result from the first call in the
local stack, then use this value for the second call instead of
calling the function again. However, I do want this function to be
called twice exactly without being optimized (I do want it behaves
this way even though optimization flags are used during compilation).
Is that possible? How can I do?

Thank you
Best wishes,

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

More information about the llvm-dev mailing list