Issue 91175
Summary [lld] Optimize calling one instruction function?
Labels lld
Assignees
Reporter metarutaiga
    Does the LLD have the optimization option to reduce calling function when linking?

```
./one.o:        file format mach-o arm64

Disassembly of section __TEXT,__text:

0000000000000000 <ltmp0>:
       0: b9400400      ldr     w0, [x0, #4]
       4: d65f03c0      ret

0000000000000008 <_bar>:
       8: a9bf7bfd stp     x29, x30, [sp, #-16]!
       c: 910003fd      mov     x29, sp
 10: 94000000      bl      0x10 <_bar+0x8>
      14: 11000400      add w0, w0, #1
      18: a8c17bfd      ldp     x29, x30, [sp], #16
 1c: d65f03c0      ret
```

When the LLD found the one instruction function, we can replace it.

```
      10: 94000000      bl 0x10 <_bar+0x8>
```
to
```
      10: b9400400      ldr     w0, [x0, #4]
```

I know the LTO is better than this, but I haven't LTO libraries sometimes.
And the Debugger would be not to set breakpoint.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to