[LLVMdev] How to always generate epilogue code?
kai.nacke at redstar.de
Sun May 26 04:22:23 PDT 2013
I am still working on the Win64 EH code and now have a pretty usable
result. (The MC part is already posted to llvm-commits, the other
part follows soon. If you are curious the whole patch is here:
However, in one case I have a problem with LLVM being too smart.
Consider the following D code:
throw new Exception("Failure");
The code after the throw statement is unreachable. The last instruction
of the finally block is a resume. LLVM now removes the last printf call
and the epilogue code because it is all dead code. In fact the last
instruction generated for this function is a call to the unwind_resume
Unfortunately Windows 64bit requires the epilogue code to perform the
stack unwinding. In this special case it is not dead code but another
form of metadata. See here:
Is there a simple way to always enforce the generation of the epilogue?
E.g. can I mark the epilogue as always reachable?
More information about the llvm-dev