[llvm] [CodeGen][X86] Fix lowering of tailcalls when `-ms-hotpatch` is used (PR #77245)

Shengchen Kan via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 7 18:37:49 PST 2024


================
@@ -87,6 +87,9 @@ bool PatchableFunction::runOnMachineFunction(MachineFunction &MF) {
   for (auto &MO : FirstActualI->operands())
     MIB.add(MO);
 
+  if (FirstActualI->shouldUpdateCallSiteInfo())
+    MF.eraseCallSiteInfo(&*FirstActualI);
----------------
KanRobert wrote:

Maybe we don't need this. According to the description above, `PatchableFunction` needs the first instruction is two-byte long.

http://xxeo.com/single-byte-or-small-x86-opcodes

One-byte instruction is rare in X86. `TailCall` can be transformed to either  a `call` or a `jmp`, which is always longer than 2 bytes. I think we can just skip emitting patchable-op if the first instruction is a `TailCall`.

https://github.com/llvm/llvm-project/pull/77245


More information about the llvm-commits mailing list