[PATCH] D140931: Improve and enable folding of conditional branches with tail calls.
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 4 00:04:14 PST 2023
goldstein.w.n added a comment.
In D140931#4025075 <https://reviews.llvm.org/D140931#4025075>, @pengfei wrote:
> I'm not sure if we can arbitrarily replace `jmp foo` with `jcc foo`. At least `jmp` has a large range (64-bit) scope which supports code size > 2GB. Maybe we should limit it to kernel/small code model?
Can it? https://www.felixcloutier.com/x86/jmp I though `rel32` was maximum imm encoding.
But in `canMakeTailCallConditional` we have:
if (TailCall.getOpcode() != X86::TCRETURNdi &&
TailCall.getOpcode() != X86::TCRETURNdi64) {
// Only direct calls can be done with a conditional branch.
return false;
}
We could limit `X86::TCRETURNdi64` with kernel/small-code model. Although this is done after
reg alloc and only within function so we could only do if function has less than 2^32 / 16 instructions
and be safe.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140931/new/
https://reviews.llvm.org/D140931
More information about the llvm-commits
mailing list