[Mlir-commits] [mlir] [MLIR][LLVM] Implement LLVM dialect support for global aliases (PR #125295)
Bruno Cardoso Lopes
llvmlistbot at llvm.org
Wed Feb 5 11:15:25 PST 2025
================
@@ -2036,22 +2036,28 @@ LLVMFuncOp AddressOfOp::getFunction(SymbolTableCollection &symbolTable) {
symbolTable.lookupSymbolIn(parentLLVMModule(*this), getGlobalNameAttr()));
}
+AliasOp AddressOfOp::getAlias(SymbolTableCollection &symbolTable) {
+ return dyn_cast_or_null<AliasOp>(
+ symbolTable.lookupSymbolIn(parentLLVMModule(*this), getGlobalNameAttr()));
+}
+
LogicalResult
AddressOfOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
Operation *symbol =
symbolTable.lookupSymbolIn(parentLLVMModule(*this), getGlobalNameAttr());
auto global = dyn_cast_or_null<GlobalOp>(symbol);
auto function = dyn_cast_or_null<LLVMFuncOp>(symbol);
+ auto alias = dyn_cast_or_null<AliasOp>(symbol);
- if (!global && !function)
- return emitOpError(
- "must reference a global defined by 'llvm.mlir.global' or 'llvm.func'");
+ if (!global && !function && !alias)
+ return emitOpError("must reference a global defined by 'llvm.mlir.global', "
+ "'llvm.mlir.alias' or 'llvm.func'");
LLVMPointerType type = getType();
- if (global && global.getAddrSpace() != type.getAddressSpace())
+ if ((global && global.getAddrSpace() != type.getAddressSpace()))
----------------
bcardosolopes wrote:
Might you were looking at some older version? There is not such check anymore after I removed the address space as a operation attribute (doesn't make sense to have it, because we derive directly from the return op now).
https://github.com/llvm/llvm-project/pull/125295
More information about the Mlir-commits
mailing list