[llvm-dev] Optimization options at different levels

Carlo Kok via llvm-dev llvm-dev at lists.llvm.org
Wed Jul 18 23:34:56 PDT 2018


Hi,

What's the relation between the codegen optimization level passed to TargetMachine and the optimizations done by the pass builder?

I noticed that when LLVM processes an Invoke it becomes something like:

    0x10000194d <+29>:  callq  0x1000017a0               ; createObj at program.cs:13
    0x100001952 <+34>:  movq   %rax, -0x30(%rbp)
    0x100001956 <+38>:  jmp    0x100001958               ; <+40> at program.cs:19
    0x100001958 <+40>:  movq   -0x30(%rbp), %rdi
    0x10000195c <+44>: callq 0x10001a010 ; symbol stub for: objc_retainAutoreleasedReturnValue


the problem here is that objc_autoreleaseReturnValue looks at the callstack and immediate return has to be something like:
movq %rdi, %rax
callq objc_retainAutoreleasedReturnValue 

However I don't want the optimizing to interfere with debug info. So my question is, is there any combination of optimization modes that would remove the pointless jmp and move the result of createObj directly to a parameter for objc_retainAutoreleasedReturnValue but still keep debug info as it should be?


More information about the llvm-dev mailing list