Xueying ZHANG
2011-Aug-03 09:43 UTC
[LLVMdev] Help !! Problem about Intrinsic::returnaddress and optimization
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, Ying -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.
Bill Wendling
2011-Aug-03 18:41 UTC
[LLVMdev] Help !! Problem about Intrinsic::returnaddress and optimization
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
Seemingly Similar Threads
- [LLVMdev] Help !! Problem about Intrinsic::returnaddress and optimization
- [LLVMdev] How to get the return address on the stack on LLVM
- [LLVMdev] Question about SimplifyXorInst
- [LLVMdev] New Problem: llc -O0: Broken module found, compilation aborted!
- [LLVMdev] How to get the return address on the stack on LLVM