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

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 13 15:18:21 PDT 2022


efriedma added a comment.

> 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.


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