From cea283ae934e7a220098aaa9b70ca2e26b5562f3 Mon Sep 17 00:00:00 2001 From: Francesco Bertolaccini Date: Thu, 5 Jun 2025 14:04:52 +0200 Subject: [PATCH] [LLVMIR][HACK] Prefer emitting indirect calls if possible --- mlir/lib/Target/LLVMIR/ModuleImport.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mlir/lib/Target/LLVMIR/ModuleImport.cpp b/mlir/lib/Target/LLVMIR/ModuleImport.cpp index cf058dd3e31e2..fc394b6782f96 100644 --- a/mlir/lib/Target/LLVMIR/ModuleImport.cpp +++ b/mlir/lib/Target/LLVMIR/ModuleImport.cpp @@ -1802,11 +1802,11 @@ LogicalResult ModuleImport::convertInstruction(llvm::Instruction *inst) { return failure(); FlatSymbolRefAttr callee = nullptr; - if (isIncompatibleCall) { + FlatSymbolRefAttr calleeSym = convertCalleeName(callInst); + if (calleeSym) { // Use an indirect call (in order to represent valid and verifiable LLVM // IR). Build the indirect call by passing an empty `callee` operand and // insert into `operands` to include the indirect call target. - FlatSymbolRefAttr calleeSym = convertCalleeName(callInst); Value indirectCallVal = builder.create( loc, LLVM::LLVMPointerType::get(context), calleeSym); operands->insert(operands->begin(), indirectCallVal);