[llvm] [win][x64] Fix import call optimization for calls to dllimports and global function pointers (PR #160604)
Daniel Paoliello via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 25 11:45:35 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.
----------------
dpaoliello wrote:
Fair enough. Added a new `CALL64_ImpCall` pseudo and lowered it to CALL64m in X86ExpandPseudo.
https://github.com/llvm/llvm-project/pull/160604
More information about the llvm-commits
mailing list