Skip to content

Commit d52166a

Browse files
committed
[MLIR] Make getUserSymbol return SymbolRefAttr
1 parent 1030725 commit d52166a

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

mlir/include/mlir/IR/SymbolInterfaces.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def SymbolUserOpInterface : OpInterface<"SymbolUserOpInterface"> {
219219
>,
220220
InterfaceMethod<
221221
/*desc=*/"Get user symbol attribute, returns empty if not set",
222-
/*retTy=*/"std::optional<::mlir::StringRef>",
222+
/*retTy=*/"SymbolRefAttr",
223223
/*methodName=*/"getUserSymbol",
224224
(ins), [{}],
225225
/*defaultImplementation=*/[{

mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ LogicalResult CallOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
12931293

12941294
return success();
12951295
}
1296-
std::optional<::mlir::StringRef> CallOp::getUserSymbol() { return getCallee(); }
1296+
SymbolRefAttr CallOp::getUserSymbol() { return getCalleeAttr(); }
12971297

12981298
void CallOp::print(OpAsmPrinter &p) {
12991299
auto callee = getCallee();
@@ -2058,9 +2058,7 @@ AddressOfOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
20582058
return success();
20592059
}
20602060

2061-
std::optional<::mlir::StringRef> AddressOfOp::getUserSymbol() {
2062-
return getGlobalName();
2063-
}
2061+
SymbolRefAttr AddressOfOp::getUserSymbol() { return getGlobalNameAttr(); }
20642062

20652063
// AddressOfOp constant-folds to the global symbol name.
20662064
OpFoldResult LLVM::AddressOfOp::fold(FoldAdaptor) {

0 commit comments

Comments
 (0)