Fix printer for llvm.addressof symbol name that need escaping

Differential Revision: https://reviews.llvm.org/D73065
This commit is contained in:
Mehdi Amini 2020-01-20 21:00:31 +00:00
parent 2e42cc7a50
commit fdb9cc7dc5
2 changed files with 6 additions and 5 deletions

View File

@ -767,7 +767,8 @@ GlobalOp AddressOfOp::getGlobal() {
}
static void printAddressOfOp(OpAsmPrinter &p, AddressOfOp op) {
p << op.getOperationName() << " @" << op.global_name();
p << op.getOperationName() << " ";
p.printSymbolName(op.global_name());
p.printOptionalAttrDict(op.getAttrs(), {"global_name"});
p << " : " << op.getResult().getType();
}

View File

@ -6,8 +6,8 @@ llvm.mlir.global internal @global(42 : i64) : !llvm.i64
// CHECK: llvm.mlir.global internal constant @constant(3.700000e+01 : f64) : !llvm.float
llvm.mlir.global internal constant @constant(37.0) : !llvm.float
// CHECK: llvm.mlir.global internal constant @string("foobar")
llvm.mlir.global internal constant @string("foobar") : !llvm<"[6 x i8]">
// CHECK: llvm.mlir.global internal constant @".string"("foobar")
llvm.mlir.global internal constant @".string"("foobar") : !llvm<"[6 x i8]">
// CHECK: llvm.mlir.global internal @string_notype("1234567")
llvm.mlir.global internal @string_notype("1234567")
@ -51,8 +51,8 @@ func @references() {
// CHECK: llvm.mlir.addressof @global : !llvm<"i64*">
%0 = llvm.mlir.addressof @global : !llvm<"i64*">
// CHECK: llvm.mlir.addressof @string : !llvm<"[6 x i8]*">
%1 = llvm.mlir.addressof @string : !llvm<"[6 x i8]*">
// CHECK: llvm.mlir.addressof @".string" : !llvm<"[6 x i8]*">
%1 = llvm.mlir.addressof @".string" : !llvm<"[6 x i8]*">
llvm.return
}