Dario Domizioli
2014-Jul-08 11:40 UTC
[LLVMdev] General issue with late creation of function calls
Hello LLVM! I have recently noticed an issue which makes LLVM incorrectly recognize a function as a 'leaf' function when it isn't, and I have filed PR20243 ( http://llvm.org/bugs/show_bug.cgi?id=20243). The bug I have reported is specific to one particular case where this happens, but I worry that the problem might be more general. Essentially, the issue is that some backends expand instructions to calls to runtime library functions not only at instruction selection stage, but also in their AsmPrinter's (i.e. very late). In the PR I referenced, this happens with the creation of a call to __tls_get_addr in the X86 backend. Because of this, the call is invisible to any analysis or inspection running before the AsmPrinter. Therefore, code that performs decisions based on whether the function is a leaf (in the PR, the issue is with -momit-leaf-frame-pointer) is going to make the wrong decision.>From a quick grep I can see that the PPC backend and the Sparc backend alsodo some handling of __tls_get_addr, but I haven't checked in detail. Also, there may be more instances of other function calls being generated too late. So I wanted to point this out to the community as a possible general issue to look into. I found one case, but there may be others. Cheers, Dario Domizioli SN Systems - Sony Computer Entertainment Group -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140708/ba52be21/attachment.html>