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

Bill Wendling wendling at apple.com
Wed Aug 3 11:41:31 PDT 2011


On Aug 3, 2011, at 2:43 AM, Xueying ZHANG wrote:

> 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?
> 
Hi Ying,

Have you tried making the variable you're using 'volatile'? (I don't know if this will help, but...)

-bw




More information about the llvm-dev mailing list