[LLVMdev] Backend optimizations
mats petersson
mats at planetcatfish.com
Mon Jan 26 06:18:21 PST 2015
>From the department of ignorance and stupid suggestions: Run this
conversion after other passes that deal with call instructions?
Side question: Is this targeting some unusual x86 architecture, as I
believe this would be quite detrimental to performance on modern CPUs,
as they use the pair of call/return to do predictive execution, so if
you remove the CALL, the return will "unbalance" the call stack
management, and lead to slower execution.
--
Mats
On 26 January 2015 at 13:21, Rinaldini Julien
<julien.rinaldini at heig-vd.ch> wrote:
> Hi,
>
> I'm writting an intrinsics for the X86 plateform that replace every
> 'call' instruction by a 'push ret_addr' followed by a 'jmp func_addr'.
> I'm doing this in the X86ISelLowering class with a custom inserter.
>
> So if I have something like this:
>
> 0x0 call foobar
> 0x1 ...
>
> the call will be replaced like this:
>
> 0x0 push 0x2
> 0x1 jmp foobar_addr
> 0x2 ...
>
> This works fine in -O0, but when I try to compile in -O1,2,3, my program
> fails. Since there is no more 'call' instruction, the optimizations in
> the backend remove the operation that manage the function's arguments (I
> guess it thinks the arguments are not needed anymore).
>
> How can I resolve this problem? Is there a specific pass that remove
> unused values that I can disabled?
>
> Cheers
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list