[Mlir-commits] [mlir] [mlir][LLVMIR] Add IFuncOp to LLVM dialect (PR #147697)
Robert Konicar
llvmlistbot at llvm.org
Fri Jul 11 09:23:52 PDT 2025
================
@@ -2682,6 +2694,59 @@ unsigned AliasOp::getAddrSpace() {
return ptrTy.getAddressSpace();
}
+//===----------------------------------------------------------------------===//
+// IFuncOp
+//===----------------------------------------------------------------------===//
+
+void IFuncOp::build(OpBuilder &builder, OperationState &result, StringRef name,
+ Type iFuncType, StringRef resolverName, Type resolverType,
+ Linkage linkage, LLVM::Visibility visibility) {
+ return build(builder, result, name, iFuncType, resolverName, resolverType,
+ linkage, /*dso_local=*/false, /*address_space=*/0,
+ UnnamedAddr::None, visibility);
+}
+
+LogicalResult IFuncOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
+ Operation *symbol =
+ symbolTable.lookupSymbolIn(parentLLVMModule(*this), getResolverAttr());
+ auto resolver = dyn_cast<LLVMFuncOp>(symbol);
+ if (!resolver) {
+ // FIXME: Strip aliases to find the called function
+ if (isa<AliasOp>(symbol))
+ return success();
----------------
Jezurko wrote:
I am not sure how to nicely/cleanly mirror the LLVM IR logic here - the LLVM verifier internally calls stripPointerCastsAndAliases to find the resolver function.
In the AliasOp init region there might be quite a lot of stuff happening, so backtracking through might be quite complicated… One idea I had was to look simply for `AddressOp`s and jump based on those… But I'm not sure if that's sound.
https://github.com/llvm/llvm-project/pull/147697
More information about the Mlir-commits
mailing list