[PATCH] D129677: Disable machine function splitting for functions with inline asm br

Adrian Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 14 13:27:33 PDT 2022


adriantong1024 abandoned this revision.
adriantong1024 added a comment.

In D129677#3649972 <https://reviews.llvm.org/D129677#3649972>, @efriedma wrote:

>> It also seems like such a case is easy to fix; in the inline asm the user should just use the wider encoding.
>
> There's always going to be some limit to the distance unless you use an indirect branch.  Well, except on weird targets like x86, where a direct branch can reach everywhere.  I guess on targets like AArch64, you could mark the branch destinations as functions, and let the linker could insert a stub.  But people writing inline asm probably don't expect a branch to clobber x16/x17...
>
> Once we start imposing any restriction on the distance, we need a patch like this: if the destination is in a different section, we can't promise anything about the distance.
>
> I wouldn't expect this to be an issue on x86, though; even on 64-bit, people normally use the "small" code model, so a "jmp" should reach anywhere in the binary.  So I'm not sure what the testcase is supposed to be testing.

Thanks for the discussion!

The problem this patch is trying to fix is discovered on AArch64 where the conditional branch b.ge is too short after MFS places hot and cold blocks apart.

I am convinced  its a bad idea to impose any restriction on the distance. I think having a warning in MFS to help user prevent linker error would be something nice to have.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129677/new/

https://reviews.llvm.org/D129677



More information about the llvm-commits mailing list