[llvm] [win][x64] Fix import call optimization for calls to dllimports and global function pointers (PR #160604)
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 24 14:47:39 PDT 2025
================
@@ -2551,13 +2552,19 @@ void X86AsmPrinter::emitInstruction(const MachineInstr *MI) {
emitLabelAndRecordForImportCallOptimization(
IMAGE_RETPOLINE_AMD64_IMPORT_CALL);
- MCInst TmpInst;
- MCInstLowering.Lower(MI, TmpInst);
-
// For Import Call Optimization to work, we need a the call instruction
// with a rex prefix, and a 5-byte nop after the call instruction.
EmitAndCountInstruction(MCInstBuilder(X86::REX64_PREFIX));
- emitCallInstruction(TmpInst);
+ // Following the pattern of how dllimport calls are lowered in FastISel.
----------------
efriedma-quic wrote:
Not sure it's helpful to refer to fastisel here.
Would it make sense to choose the correct opcode earlier? Like, if we're going to emit an indirect call, emit it as CALL64m in the first place.
https://github.com/llvm/llvm-project/pull/160604
More information about the llvm-commits
mailing list