llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
26.71k stars 10.94k forks source link

[BOLT] Bolt cannot correctly recognize tail calls on aarch64. #91571

Open YuanSha0 opened 1 month ago

YuanSha0 commented 1 month ago

image image image I traced this function using GDB and found that the BR instruction is actually a tail call, but the result of BC.MIB->isTailCall() is false.

yota9 commented 1 month ago

AArch64 currently has weak support of indirect branch analyzation. I suspect that most of the time we can't really say if it is a tail call or not.

YuanSha0 commented 1 month ago

I also noticed limited support for stack and frame analysis, so to achieve my optimization, I've added significant support for aarch64. Thanks!

YuanSha0 commented 1 month ago

@yota9 I noticed that many sources mention that BOLT supports static linking files, but I encountered errors while using it. Could it be due to aarch64? Not only does it not support indirect jumps, but its output also mentions that it cannot correctly recognize relocation entries. image The compilation options for this executable file are: clang -o susan susan.c -Wl,-q -std=c89 -lm -Os -static