Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mlir][debug] Allow multiple DIGlobalVariableExpression on globals. #111981

Merged
merged 5 commits into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions flang/lib/Optimizer/CodeGen/CodeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2808,14 +2808,14 @@ struct GlobalOpConversion : public fir::FIROpConversion<fir::GlobalOp> {
matchAndRewrite(fir::GlobalOp global, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {

mlir::LLVM::DIGlobalVariableExpressionAttr dbgExpr;
llvm::SmallVector<mlir::Attribute> dbgExprs;

if (auto fusedLoc = mlir::dyn_cast<mlir::FusedLoc>(global.getLoc())) {
if (auto gvAttr =
mlir::dyn_cast_or_null<mlir::LLVM::DIGlobalVariableAttr>(
fusedLoc.getMetadata())) {
dbgExpr = mlir::LLVM::DIGlobalVariableExpressionAttr::get(
global.getContext(), gvAttr, mlir::LLVM::DIExpressionAttr());
dbgExprs.push_back(mlir::LLVM::DIGlobalVariableExpressionAttr::get(
global.getContext(), gvAttr, mlir::LLVM::DIExpressionAttr()));
}
}

Expand All @@ -2831,7 +2831,7 @@ struct GlobalOpConversion : public fir::FIROpConversion<fir::GlobalOp> {
llvm::ArrayRef<mlir::NamedAttribute> attrs;
auto g = rewriter.create<mlir::LLVM::GlobalOp>(
loc, tyAttr, isConst, linkage, global.getSymName(), initAttr, 0, 0,
false, false, comdat, attrs, dbgExpr);
false, false, comdat, attrs, dbgExprs);

if (global.getAlignment() && *global.getAlignment() > 0)
g.setAlignment(*global.getAlignment());
Expand Down
4 changes: 2 additions & 2 deletions flang/test/Transforms/debug-module-2.fir
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ module {
// CHECK-DAG: #[[GLR:.*]] = #llvm.di_global_variable<{{.*}}name = "glr", linkageName = "_QMhelperEglr"{{.*}}>
// CHECK-DAG: #[[GLIE:.*]] = #llvm.di_global_variable_expression<var = #[[GLI]]>
// CHECK-DAG: #[[GLRE:.*]] = #llvm.di_global_variable_expression<var = #[[GLR]]>
// CHECK-DAG: llvm.mlir.global{{.*}}@_QMhelperEgli() {{{.*}}dbg_expr = #[[GLIE]]}
// CHECK-DAG: llvm.mlir.global{{.*}}@_QMhelperEglr() {{{.*}}dbg_expr = #[[GLRE]]}
// CHECK-DAG: llvm.mlir.global{{.*}}@_QMhelperEgli() {{{.*}}dbg_exprs = [#[[GLIE]]]}
// CHECK-DAG: llvm.mlir.global{{.*}}@_QMhelperEglr() {{{.*}}dbg_exprs = [#[[GLRE]]]}
4 changes: 4 additions & 0 deletions mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,10 @@ def LLVM_DIGlobalVariableExpressionAttr
let constBuilderCall = "$0";
}

def DIGlobalVariableExpressionArrayAttr :
TypedArrayAttrBase<LLVM_DIGlobalVariableExpressionAttr,
"an array of variable expressions">;

//===----------------------------------------------------------------------===//
// DIGlobalVariableAttr
//===----------------------------------------------------------------------===//
Expand Down
4 changes: 2 additions & 2 deletions mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,7 @@ def LLVM_GlobalOp : LLVM_Op<"mlir.global",
OptionalAttr<UnnamedAddr>:$unnamed_addr,
OptionalAttr<StrAttr>:$section,
OptionalAttr<SymbolRefAttr>:$comdat,
DefaultValuedAttr<LLVM_DIGlobalVariableExpressionAttr, "{}">:$dbg_expr,
OptionalAttr<DIGlobalVariableExpressionArrayAttr>:$dbg_exprs,
DefaultValuedAttr<Visibility, "mlir::LLVM::Visibility::Default">:$visibility_
);
let summary = "LLVM dialect global.";
Expand Down Expand Up @@ -1279,7 +1279,7 @@ def LLVM_GlobalOp : LLVM_Op<"mlir.global",
CArg<"bool", "false">:$thread_local_,
CArg<"SymbolRefAttr", "{}">:$comdat,
CArg<"ArrayRef<NamedAttribute>", "{}">:$attrs,
CArg<"DIGlobalVariableExpressionAttr", "{}">:$dbgExpr)>
CArg<"ArrayRef<Attribute>", "{}">:$dbgExprs)>
];

let extraClassDeclaration = [{
Expand Down
7 changes: 4 additions & 3 deletions mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2089,7 +2089,7 @@ void GlobalOp::build(OpBuilder &builder, OperationState &result, Type type,
Attribute value, uint64_t alignment, unsigned addrSpace,
bool dsoLocal, bool threadLocal, SymbolRefAttr comdat,
ArrayRef<NamedAttribute> attrs,
DIGlobalVariableExpressionAttr dbgExpr) {
ArrayRef<Attribute> dbgExprs) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ArrayRef<Attribute> dbgExprs) {
ArrayRef<DIGlobalVariableExpressionAttr> dbgExprs) {

Can this be typed (here and in the other places)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this but it did not work. The DIGlobalVariableExpressionArrayAttr becomes an ArrayAttr and that takes an ArrayRef<Attribute> and compiler does not allow ArrayRef<DIGlobalVariableExpressionAttr> to be passed for that. I thought doing manual conversion was not worth the gain.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok makes sense! I think DIGlobalVariableExpressionArrayAttr has a verifier so things should ultimately be checked.

result.addAttribute(getSymNameAttrName(result.name),
builder.getStringAttr(name));
result.addAttribute(getGlobalTypeAttrName(result.name), TypeAttr::get(type));
Expand Down Expand Up @@ -2121,8 +2121,9 @@ void GlobalOp::build(OpBuilder &builder, OperationState &result, Type type,
builder.getI32IntegerAttr(addrSpace));
result.attributes.append(attrs.begin(), attrs.end());

if (dbgExpr)
result.addAttribute(getDbgExprAttrName(result.name), dbgExpr);
if (!dbgExprs.empty())
result.addAttribute(getDbgExprsAttrName(result.name),
ArrayAttr::get(builder.getContext(), dbgExprs));

result.addRegion();
}
Expand Down
12 changes: 7 additions & 5 deletions mlir/lib/Target/LLVMIR/ModuleImport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -914,14 +914,16 @@ LogicalResult ModuleImport::convertGlobal(llvm::GlobalVariable *globalVar) {

// Get the global expression associated with this global variable and convert
// it.
DIGlobalVariableExpressionAttr globalExpressionAttr;
SmallVector<Attribute> globalExpressionAttrs;
SmallVector<llvm::DIGlobalVariableExpression *> globalExpressions;
globalVar->getDebugInfo(globalExpressions);

// There should only be a single global expression.
if (!globalExpressions.empty())
globalExpressionAttr =
debugImporter->translateGlobalVariableExpression(globalExpressions[0]);
for (auto expr : globalExpressions) {
abidh marked this conversation as resolved.
Show resolved Hide resolved
DIGlobalVariableExpressionAttr globalExpressionAttr =
debugImporter->translateGlobalVariableExpression(expr);
globalExpressionAttrs.push_back(globalExpressionAttr);
}

// Workaround to support LLVM's nameless globals. MLIR, in contrast to LLVM,
// always requires a symbol name.
Expand All @@ -935,7 +937,7 @@ LogicalResult ModuleImport::convertGlobal(llvm::GlobalVariable *globalVar) {
valueAttr, alignment, /*addr_space=*/globalVar->getAddressSpace(),
/*dso_local=*/globalVar->isDSOLocal(),
/*thread_local=*/globalVar->isThreadLocal(), /*comdat=*/SymbolRefAttr(),
/*attrs=*/ArrayRef<NamedAttribute>(), /*dbgExpr=*/globalExpressionAttr);
/*attrs=*/ArrayRef<NamedAttribute>(), /*dbgExprs=*/globalExpressionAttrs);
globalInsertionOp = globalOp;

if (globalVar->hasInitializer() && !valueAttr) {
Expand Down
78 changes: 41 additions & 37 deletions mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1055,44 +1055,48 @@ LogicalResult ModuleTranslation::convertGlobals() {
globalsMapping.try_emplace(op, var);

// Add debug information if present.
if (op.getDbgExpr()) {
llvm::DIGlobalVariableExpression *diGlobalExpr =
debugTranslation->translateGlobalVariableExpression(op.getDbgExpr());
llvm::DIGlobalVariable *diGlobalVar = diGlobalExpr->getVariable();
var->addDebugInfo(diGlobalExpr);

// There is no `globals` field in DICompileUnitAttr which can be directly
// assigned to DICompileUnit. We have to build the list by looking at the
// dbgExpr of all the GlobalOps. The scope of the variable is used to get
// the DICompileUnit in which to add it.
// But there are cases where the scope of a global does not
// directly point to the DICompileUnit and we have to do a bit more work
// to get to it. Some of those cases are:
//
// 1. For the languages that support modules, the scope hierarchy can be
// variable -> DIModule -> DICompileUnit
//
// 2. For the Fortran common block variable, the scope hierarchy can be
// variable -> DICommonBlock -> DISubprogram -> DICompileUnit
//
// 3. For entities like static local variables in C or variable with
// SAVE attribute in Fortran, the scope hierarchy can be
// variable -> DISubprogram -> DICompileUnit
llvm::DIScope *scope = diGlobalVar->getScope();
if (auto *mod = dyn_cast_if_present<llvm::DIModule>(scope))
scope = mod->getScope();
else if (auto *cb = dyn_cast_if_present<llvm::DICommonBlock>(scope)) {
if (auto *sp = dyn_cast_if_present<llvm::DISubprogram>(cb->getScope()))
if (op.getDbgExprs()) {
for (auto exprAttr :
op.getDbgExprs()->getAsRange<DIGlobalVariableExpressionAttr>()) {
llvm::DIGlobalVariableExpression *diGlobalExpr =
debugTranslation->translateGlobalVariableExpression(exprAttr);
llvm::DIGlobalVariable *diGlobalVar = diGlobalExpr->getVariable();
var->addDebugInfo(diGlobalExpr);

// There is no `globals` field in DICompileUnitAttr which can be
// directly assigned to DICompileUnit. We have to build the list by
// looking at the dbgExpr of all the GlobalOps. The scope of the
// variable is used to get the DICompileUnit in which to add it. But
// there are cases where the scope of a global does not directly point
// to the DICompileUnit and we have to do a bit more work to get to
// it. Some of those cases are:
//
// 1. For the languages that support modules, the scope hierarchy can
// be variable -> DIModule -> DICompileUnit
//
// 2. For the Fortran common block variable, the scope hierarchy can
// be variable -> DICommonBlock -> DISubprogram -> DICompileUnit
//
// 3. For entities like static local variables in C or variable with
// SAVE attribute in Fortran, the scope hierarchy can be
// variable -> DISubprogram -> DICompileUnit
llvm::DIScope *scope = diGlobalVar->getScope();
if (auto *mod = dyn_cast_if_present<llvm::DIModule>(scope))
scope = mod->getScope();
else if (auto *cb = dyn_cast_if_present<llvm::DICommonBlock>(scope)) {
if (auto *sp =
dyn_cast_if_present<llvm::DISubprogram>(cb->getScope()))
scope = sp->getUnit();
} else if (auto *sp = dyn_cast_if_present<llvm::DISubprogram>(scope))
scope = sp->getUnit();
} else if (auto *sp = dyn_cast_if_present<llvm::DISubprogram>(scope))
scope = sp->getUnit();

// Get the compile unit (scope) of the the global variable.
if (llvm::DICompileUnit *compileUnit =
dyn_cast_if_present<llvm::DICompileUnit>(scope)) {
// Update the compile unit with this incoming global variable expression
// during the finalizing step later.
allGVars[compileUnit].push_back(diGlobalExpr);

// Get the compile unit (scope) of the the global variable.
if (llvm::DICompileUnit *compileUnit =
dyn_cast_if_present<llvm::DICompileUnit>(scope)) {
// Update the compile unit with this incoming global variable
// expression during the finalizing step later.
allGVars[compileUnit].push_back(diGlobalExpr);
}
}
}
}
Expand Down
13 changes: 12 additions & 1 deletion mlir/test/Dialect/LLVMIR/debuginfo.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,18 @@
file = #file, line = 2, type = #int0>
#var_expression = #llvm.di_global_variable_expression<var = #global_var,
expr = <>>
llvm.mlir.global common @block_() {dbg_expr = #var_expression} : i64
#global_var1 = #llvm.di_global_variable<scope = #di_common_block, name = "b",
file = #file, line = 3, type = #int0>
#var_expression1 = #llvm.di_global_variable_expression<var = #global_var1,
expr = <>>
llvm.mlir.global @data() {dbg_exprs = [#var_expression, #var_expression1]} : i64

// CHECK-DAG: llvm.mlir.global external @data() {{{.*}}dbg_exprs = [#[[EXP1:.*]], #[[EXP2:.*]]]} : i64
// CHECK-DAG: #[[EXP1]] = #llvm.di_global_variable_expression<var = #[[GV1:.*]], expr = <>>
// CHECK-DAG: #[[EXP2]] = #llvm.di_global_variable_expression<var = #[[GV2:.*]], expr = <>>
// CHECK-DAG: #[[GV1]] = #llvm.di_global_variable<{{.*}}name = "a"{{.*}}>
// CHECK-DAG: #[[GV2]] = #llvm.di_global_variable<{{.*}}name = "b"{{.*}}>


// CHECK: llvm.func @addr(%[[ARG:.*]]: i64)
llvm.func @addr(%arg: i64) {
Expand Down
16 changes: 8 additions & 8 deletions mlir/test/Dialect/LLVMIR/global.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,15 @@ llvm.mlir.global @target_fail(0 : i64) : !llvm.target<"spirv.Image", i32, 0>
// CHECK-DAG: #[[EXPR1:.*]] = #llvm.di_global_variable_expression<var = #[[GVAR1]], expr = <[DW_OP_push_object_address, DW_OP_deref]>>
// CHECK-DAG: #[[EXPR2:.*]] = #llvm.di_global_variable_expression<var = #[[GVAR2]], expr = <[DW_OP_LLVM_arg(0), DW_OP_LLVM_arg(1), DW_OP_plus]>>
// CHECK-DAG: #[[EXPR3:.*]] = #llvm.di_global_variable_expression<var = #[[GVAR3]], expr = <[DW_OP_LLVM_convert(16, DW_ATE_signed)]>>
// CHECK-DAG: llvm.mlir.global external @global_with_expr1() {addr_space = 0 : i32, dbg_expr = #[[EXPR0]]} : i64
// CHECK-DAG: llvm.mlir.global external @global_with_expr2() {addr_space = 0 : i32, dbg_expr = #[[EXPR1]]} : i64
// CHECK-DAG: llvm.mlir.global external @global_with_expr3() {addr_space = 0 : i32, dbg_expr = #[[EXPR2]]} : i64
// CHECK-DAG: llvm.mlir.global external @global_with_expr4() {addr_space = 0 : i32, dbg_expr = #[[EXPR3]]} : i64
// CHECK-DAG: llvm.mlir.global external @global_with_expr1() {addr_space = 0 : i32, dbg_expr = [#[[EXPR0]]]} : i64
// CHECK-DAG: llvm.mlir.global external @global_with_expr2() {addr_space = 0 : i32, dbg_expr = [#[[EXPR1]]]} : i64
// CHECK-DAG: llvm.mlir.global external @global_with_expr3() {addr_space = 0 : i32, dbg_expr = [#[[EXPR2]]]} : i64
// CHECK-DAG: llvm.mlir.global external @global_with_expr4() {addr_space = 0 : i32, dbg_expr = [#[[EXPR3]]]} : i64

#di_file = #llvm.di_file<"not" in "existence">
#di_compile_unit = #llvm.di_compile_unit<id = distinct[0]<>, sourceLanguage = DW_LANG_C, file = #di_file, producer = "MLIR", isOptimized = true, emissionKind = Full>
#di_basic_type = #llvm.di_basic_type<tag = DW_TAG_base_type, name = "uint64_t", sizeInBits = 64, encoding = DW_ATE_unsigned>
llvm.mlir.global external @global_with_expr1() {addr_space = 0 : i32, dbg_expr = #llvm.di_global_variable_expression<var = <scope = #di_compile_unit, name = "global_with_expr_1", linkageName = "global_with_expr_1", file = #di_file, line = 370, type = #di_basic_type, isLocalToUnit = true, isDefined = true, alignInBits = 8>, expr = <>>} : i64
llvm.mlir.global external @global_with_expr2() {addr_space = 0 : i32, dbg_expr = #llvm.di_global_variable_expression<var = <scope = #di_compile_unit, name = "global_with_expr_2", linkageName = "global_with_expr_2", file = #di_file, line = 371, type = #di_basic_type, isLocalToUnit = true, isDefined = true, alignInBits = 8>, expr = <[DW_OP_push_object_address, DW_OP_deref]>>} : i64
llvm.mlir.global external @global_with_expr3() {addr_space = 0 : i32, dbg_expr = #llvm.di_global_variable_expression<var = <scope = #di_compile_unit, name = "global_with_expr_3", linkageName = "global_with_expr_3", file = #di_file, line = 372, type = #di_basic_type, isLocalToUnit = true, isDefined = true, alignInBits = 8>, expr = <[DW_OP_LLVM_arg(0), DW_OP_LLVM_arg(1), DW_OP_plus]>>} : i64
llvm.mlir.global external @global_with_expr4() {addr_space = 0 : i32, dbg_expr = #llvm.di_global_variable_expression<var = <scope = #di_compile_unit, name = "global_with_expr_4", linkageName = "global_with_expr_4", file = #di_file, line = 373, type = #di_basic_type, isLocalToUnit = true, isDefined = true, alignInBits = 8>, expr = <[DW_OP_LLVM_convert(16, DW_ATE_signed)]>>} : i64
llvm.mlir.global external @global_with_expr1() {addr_space = 0 : i32, dbg_expr = [#llvm.di_global_variable_expression<var = <scope = #di_compile_unit, name = "global_with_expr_1", linkageName = "global_with_expr_1", file = #di_file, line = 370, type = #di_basic_type, isLocalToUnit = true, isDefined = true, alignInBits = 8>, expr = <>>]} : i64
llvm.mlir.global external @global_with_expr2() {addr_space = 0 : i32, dbg_expr = [#llvm.di_global_variable_expression<var = <scope = #di_compile_unit, name = "global_with_expr_2", linkageName = "global_with_expr_2", file = #di_file, line = 371, type = #di_basic_type, isLocalToUnit = true, isDefined = true, alignInBits = 8>, expr = <[DW_OP_push_object_address, DW_OP_deref]>>]} : i64
llvm.mlir.global external @global_with_expr3() {addr_space = 0 : i32, dbg_expr = [#llvm.di_global_variable_expression<var = <scope = #di_compile_unit, name = "global_with_expr_3", linkageName = "global_with_expr_3", file = #di_file, line = 372, type = #di_basic_type, isLocalToUnit = true, isDefined = true, alignInBits = 8>, expr = <[DW_OP_LLVM_arg(0), DW_OP_LLVM_arg(1), DW_OP_plus]>>]} : i64
llvm.mlir.global external @global_with_expr4() {addr_space = 0 : i32, dbg_expr = [#llvm.di_global_variable_expression<var = <scope = #di_compile_unit, name = "global_with_expr_4", linkageName = "global_with_expr_4", file = #di_file, line = 373, type = #di_basic_type, isLocalToUnit = true, isDefined = true, alignInBits = 8>, expr = <[DW_OP_LLVM_convert(16, DW_ATE_signed)]>>]} : i64
24 changes: 24 additions & 0 deletions mlir/test/Target/LLVMIR/Import/debug-info.ll
Original file line number Diff line number Diff line change
Expand Up @@ -867,3 +867,27 @@ define void @test() !dbg !3 {
; CHECK: #[[FILE:.+]] = #llvm.di_file<"test.f90" in "">
; CHECK: #[[SP:.+]] = #llvm.di_subprogram<{{.*}}name = "test"{{.*}}>
; CHECK: #llvm.di_common_block<scope = #[[SP]], name = "block", file = #[[FILE]], line = 3>

; // -----

@data = external global i64, !dbg !0, !dbg !5

!llvm.module.flags = !{!8}
!llvm.dbg.cu = !{!2}

!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
!1 = distinct !DIGlobalVariable(name: "a", scope: !2, file: !3, line: 2, type: !7)
!2 = distinct !DICompileUnit(language: DW_LANG_C, file: !3, globals: !4)
!3 = !DIFile(filename: "test.c", directory: "")
!4 = !{!0, !5}
!5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression())
!6 = distinct !DIGlobalVariable(name: "b", scope: !2, file: !3, line: 3, type: !7)
!7 = !DIBasicType(name: "int", size: 32)
!8 = !{i32 2, !"Debug Info Version", i32 3}


; CHECK: #[[VAR1:.+]] = #llvm.di_global_variable<{{.*}}name = "a"{{.*}}>
; CHECK: #[[VAR2:.+]] = #llvm.di_global_variable<{{.*}}name = "b"{{.*}}>
; CHECK: #[[EXP1:.+]] = #llvm.di_global_variable_expression<var = #[[VAR1]], expr = <>>
; CHECK: #[[EXP2:.+]] = #llvm.di_global_variable_expression<var = #[[VAR2]], expr = <>>
; CHECK: llvm.mlir.global external @data() {{{.*}}dbg_exprs = [#[[EXP1]], #[[EXP2]]]} : i64
6 changes: 3 additions & 3 deletions mlir/test/Target/LLVMIR/Import/global-variables.ll
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ define void @bar() {
; CHECK-DAG: #[[GVAR1:.*]] = #llvm.di_global_variable<scope = #[[SPROG]], name = "bar", linkageName = "bar", file = #[[FILE]], line = 8, type = #[[TYPE]], isLocalToUnit = true>
; CHECK-DAG: #[[EXPR0:.*]] = #llvm.di_global_variable_expression<var = #[[GVAR0]], expr = <[DW_OP_LLVM_fragment(0, 16)]>>
; CHECK-DAG: #[[EXPR1:.*]] = #llvm.di_global_variable_expression<var = #[[GVAR1]], expr = <[DW_OP_constu(3), DW_OP_plus]>>
; CHECK-DAG: llvm.mlir.global external @foo() {addr_space = 0 : i32, alignment = 8 : i64, dbg_expr = #[[EXPR0]]} : i32
; CHECK-DAG: llvm.mlir.global external @bar() {addr_space = 0 : i32, alignment = 8 : i64, dbg_expr = #[[EXPR1]]} : i32
; CHECK-DAG: llvm.mlir.global external @foo() {addr_space = 0 : i32, alignment = 8 : i64, dbg_exprs = [#[[EXPR0]]]} : i32
; CHECK-DAG: llvm.mlir.global external @bar() {addr_space = 0 : i32, alignment = 8 : i64, dbg_exprs = [#[[EXPR1]]]} : i32

@foo = external global i32, align 8, !dbg !5
@bar = external global i32, align 8, !dbg !7
Expand Down Expand Up @@ -308,7 +308,7 @@ define void @bar() {
; CHECK: llvm.mlir.global internal constant @one() {addr_space = 0 : i32, dso_local} : !llvm.ptr {
; CHECK: llvm.mlir.addressof @mlir.llvm.nameless_global_3 : !llvm.ptr

; CHECK: llvm.mlir.global external constant @".str.1"() {addr_space = 0 : i32, dbg_expr = #[[GLOBAL_VAR_EXPR]]}
; CHECK: llvm.mlir.global external constant @".str.1"() {addr_space = 0 : i32, dbg_exprs = [#[[GLOBAL_VAR_EXPR]]]}

@0 = private unnamed_addr constant [2 x i8] c"0\00"
@1 = private unnamed_addr constant [2 x i8] c"1\00"
Expand Down
Loading
Loading