Skip to content

Commit afa4681

Browse files
authored
[flang][debug] Add support for common blocks. (#112398)
This PR adds debug support for common block in flang. As variable which are part of a common block don't have a special marker to recognize them, we use the following check to find them. %0 = fir.address_of(@A) %1 = fir.convert %0 %2 = fir.coordinate_of %1, %c0 %3 = fir.convert %2 %4 = fircg.ext_declare %3 If the memref of a fircg.ext_declare points to a fir.coordinate_of and that in turn points to an fir.address_of (ignoring immediate fir.convert) then we assume that it is a common block variable. The fir.address_of gives us the global symbol which is the storage for common block and fir.coordinate_of provides the offset in this storage. The debug hierarchy looks like as subroutine f3 integer :: x, y common /a/ x, y end subroutine @a_ = global { ... } { ... }, !dbg !26, !dbg !28 !23 = !DISubprogram(name: "f3"...) !24 = !DICommonBlock(scope: !23, name: "a", ...) !25 = !DIGlobalVariable(name: "x", scope: !24 ...) !26 = !DIGlobalVariableExpression(var: !25, expr: !DIExpression()) !27 = !DIGlobalVariable(name: "y", scope: !24 ...) !28 = !DIGlobalVariableExpression(var: !27, expr: !DIExpression(DW_OP_plus_uconst, 4)) This required following changes: 1. Instead of using DIGlobalVariableAttr in the FusedLoc of GlobalOp, we use DIGlobalVariableExpressionAttr. This allows us the generate the DIExpression where we have the information. 2. Previously, only one DIGlobalVariableExpressionAttr could be linked to one global op. I recently removed this restriction in mlir. To make use of it, we add an ArrayAttr to the FusedLoc of a GlobalOp. This allows us to pass multiple DIGlobalVariableExpressionAttr. 3. I was depending on the name of global for the name of the common block. The name gets a '_' appended. I could not find a utility function in flang to remove it so I have to brute force it.
1 parent e1b5826 commit afa4681

File tree

6 files changed

+479
-10
lines changed

6 files changed

+479
-10
lines changed

flang/lib/Optimizer/CodeGen/CodeGen.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -2996,11 +2996,13 @@ struct GlobalOpConversion : public fir::FIROpConversion<fir::GlobalOp> {
29962996
llvm::SmallVector<mlir::Attribute> dbgExprs;
29972997

29982998
if (auto fusedLoc = mlir::dyn_cast<mlir::FusedLoc>(global.getLoc())) {
2999-
if (auto gvAttr =
3000-
mlir::dyn_cast_or_null<mlir::LLVM::DIGlobalVariableAttr>(
3001-
fusedLoc.getMetadata())) {
3002-
dbgExprs.push_back(mlir::LLVM::DIGlobalVariableExpressionAttr::get(
3003-
global.getContext(), gvAttr, mlir::LLVM::DIExpressionAttr()));
2999+
if (auto gvExprAttr = mlir::dyn_cast_if_present<mlir::ArrayAttr>(
3000+
fusedLoc.getMetadata())) {
3001+
for (auto attr : gvExprAttr.getAsRange<mlir::Attribute>())
3002+
if (auto dbgAttr =
3003+
mlir::dyn_cast<mlir::LLVM::DIGlobalVariableExpressionAttr>(
3004+
attr))
3005+
dbgExprs.push_back(dbgAttr);
30043006
}
30053007
}
30063008

flang/lib/Optimizer/Transforms/AddDebugInfo.cpp

+113-1
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,19 @@ class AddDebugInfoPass : public fir::impl::AddDebugInfoBase<AddDebugInfoPass> {
5959

6060
private:
6161
llvm::StringMap<mlir::LLVM::DIModuleAttr> moduleMap;
62+
llvm::StringMap<mlir::LLVM::DICommonBlockAttr> commonBlockMap;
63+
// List of GlobalVariableExpressionAttr that are attached to a given global
64+
// that represents the storage for common block.
65+
llvm::DenseMap<fir::GlobalOp, llvm::SmallVector<mlir::Attribute>>
66+
globalToGlobalExprsMap;
6267

6368
mlir::LLVM::DIModuleAttr getOrCreateModuleAttr(
6469
const std::string &name, mlir::LLVM::DIFileAttr fileAttr,
6570
mlir::LLVM::DIScopeAttr scope, unsigned line, bool decl);
71+
mlir::LLVM::DICommonBlockAttr
72+
getOrCreateCommonBlockAttr(llvm::StringRef name,
73+
mlir::LLVM::DIFileAttr fileAttr,
74+
mlir::LLVM::DIScopeAttr scope, unsigned line);
6675

6776
void handleGlobalOp(fir::GlobalOp glocalOp, mlir::LLVM::DIFileAttr fileAttr,
6877
mlir::LLVM::DIScopeAttr scope,
@@ -73,6 +82,12 @@ class AddDebugInfoPass : public fir::impl::AddDebugInfoBase<AddDebugInfoPass> {
7382
mlir::LLVM::DICompileUnitAttr cuAttr,
7483
fir::DebugTypeGenerator &typeGen,
7584
mlir::SymbolTable *symbolTable);
85+
bool createCommonBlockGlobal(fir::cg::XDeclareOp declOp,
86+
const std::string &name,
87+
mlir::LLVM::DIFileAttr fileAttr,
88+
mlir::LLVM::DIScopeAttr scopeAttr,
89+
fir::DebugTypeGenerator &typeGen,
90+
mlir::SymbolTable *symbolTable);
7691
std::optional<mlir::LLVM::DIModuleAttr>
7792
getModuleAttrFromGlobalOp(fir::GlobalOp globalOp,
7893
mlir::LLVM::DIFileAttr fileAttr,
@@ -90,6 +105,67 @@ bool debugInfoIsAlreadySet(mlir::Location loc) {
90105

91106
} // namespace
92107

108+
bool AddDebugInfoPass::createCommonBlockGlobal(
109+
fir::cg::XDeclareOp declOp, const std::string &name,
110+
mlir::LLVM::DIFileAttr fileAttr, mlir::LLVM::DIScopeAttr scopeAttr,
111+
fir::DebugTypeGenerator &typeGen, mlir::SymbolTable *symbolTable) {
112+
mlir::MLIRContext *context = &getContext();
113+
mlir::OpBuilder builder(context);
114+
std::optional<std::int64_t> optint;
115+
mlir::Operation *op = declOp.getMemref().getDefiningOp();
116+
117+
if (auto conOp = mlir::dyn_cast_if_present<fir::ConvertOp>(op))
118+
op = conOp.getValue().getDefiningOp();
119+
120+
if (auto cordOp = mlir::dyn_cast_if_present<fir::CoordinateOp>(op)) {
121+
optint = fir::getIntIfConstant(cordOp.getOperand(1));
122+
if (!optint)
123+
return false;
124+
op = cordOp.getRef().getDefiningOp();
125+
if (auto conOp2 = mlir::dyn_cast_if_present<fir::ConvertOp>(op))
126+
op = conOp2.getValue().getDefiningOp();
127+
128+
if (auto addrOfOp = mlir::dyn_cast_if_present<fir::AddrOfOp>(op)) {
129+
mlir::SymbolRefAttr sym = addrOfOp.getSymbol();
130+
if (auto global =
131+
symbolTable->lookup<fir::GlobalOp>(sym.getRootReference())) {
132+
133+
unsigned line = getLineFromLoc(global.getLoc());
134+
llvm::StringRef commonName(sym.getRootReference());
135+
// FIXME: We are trying to extract the name of the common block from the
136+
// name of the global. As part of mangling, GetCommonBlockObjectName can
137+
// add a trailing _ in the name of that global. The demangle function
138+
// does not seem to handle such cases. So the following hack is used to
139+
// remove the trailing '_'.
140+
if (commonName != Fortran::common::blankCommonObjectName &&
141+
commonName.back() == '_')
142+
commonName = commonName.drop_back();
143+
mlir::LLVM::DICommonBlockAttr commonBlock =
144+
getOrCreateCommonBlockAttr(commonName, fileAttr, scopeAttr, line);
145+
mlir::LLVM::DITypeAttr diType = typeGen.convertType(
146+
fir::unwrapRefType(declOp.getType()), fileAttr, scopeAttr, declOp);
147+
line = getLineFromLoc(declOp.getLoc());
148+
auto gvAttr = mlir::LLVM::DIGlobalVariableAttr::get(
149+
context, commonBlock, mlir::StringAttr::get(context, name),
150+
declOp.getUniqName(), fileAttr, line, diType,
151+
/*isLocalToUnit*/ false, /*isDefinition*/ true, /* alignInBits*/ 0);
152+
mlir::LLVM::DIExpressionAttr expr;
153+
if (*optint != 0) {
154+
llvm::SmallVector<mlir::LLVM::DIExpressionElemAttr> ops;
155+
ops.push_back(mlir::LLVM::DIExpressionElemAttr::get(
156+
context, llvm::dwarf::DW_OP_plus_uconst, *optint));
157+
expr = mlir::LLVM::DIExpressionAttr::get(context, ops);
158+
}
159+
auto dbgExpr = mlir::LLVM::DIGlobalVariableExpressionAttr::get(
160+
global.getContext(), gvAttr, expr);
161+
globalToGlobalExprsMap[global].push_back(dbgExpr);
162+
return true;
163+
}
164+
}
165+
}
166+
return false;
167+
}
168+
93169
void AddDebugInfoPass::handleDeclareOp(fir::cg::XDeclareOp declOp,
94170
mlir::LLVM::DIFileAttr fileAttr,
95171
mlir::LLVM::DIScopeAttr scopeAttr,
@@ -101,6 +177,11 @@ void AddDebugInfoPass::handleDeclareOp(fir::cg::XDeclareOp declOp,
101177

102178
if (result.first != fir::NameUniquer::NameKind::VARIABLE)
103179
return;
180+
181+
if (createCommonBlockGlobal(declOp, result.second.name, fileAttr, scopeAttr,
182+
typeGen, symbolTable))
183+
return;
184+
104185
// If this DeclareOp actually represents a global then treat it as such.
105186
if (auto global = symbolTable->lookup<fir::GlobalOp>(declOp.getUniqName())) {
106187
handleGlobalOp(global, fileAttr, scopeAttr, typeGen, symbolTable, declOp);
@@ -136,6 +217,22 @@ void AddDebugInfoPass::handleDeclareOp(fir::cg::XDeclareOp declOp,
136217
declOp->setLoc(builder.getFusedLoc({declOp->getLoc()}, localVarAttr));
137218
}
138219

220+
mlir::LLVM::DICommonBlockAttr AddDebugInfoPass::getOrCreateCommonBlockAttr(
221+
llvm::StringRef name, mlir::LLVM::DIFileAttr fileAttr,
222+
mlir::LLVM::DIScopeAttr scope, unsigned line) {
223+
mlir::MLIRContext *context = &getContext();
224+
mlir::LLVM::DICommonBlockAttr cbAttr;
225+
if (auto iter{commonBlockMap.find(name)}; iter != commonBlockMap.end()) {
226+
cbAttr = iter->getValue();
227+
} else {
228+
cbAttr = mlir::LLVM::DICommonBlockAttr::get(
229+
context, scope, nullptr, mlir::StringAttr::get(context, name), fileAttr,
230+
line);
231+
commonBlockMap[name] = cbAttr;
232+
}
233+
return cbAttr;
234+
}
235+
139236
// The `module` does not have a first class representation in the `FIR`. We
140237
// extract information about it from the name of the identifiers and keep a
141238
// map to avoid duplication.
@@ -227,7 +324,10 @@ void AddDebugInfoPass::handleGlobalOp(fir::GlobalOp globalOp,
227324
mlir::StringAttr::get(context, globalOp.getName()), fileAttr, line,
228325
diType, /*isLocalToUnit*/ false,
229326
/*isDefinition*/ globalOp.isInitialized(), /* alignInBits*/ 0);
230-
globalOp->setLoc(builder.getFusedLoc({globalOp->getLoc()}, gvAttr));
327+
auto dbgExpr = mlir::LLVM::DIGlobalVariableExpressionAttr::get(
328+
globalOp.getContext(), gvAttr, nullptr);
329+
auto arrayAttr = mlir::ArrayAttr::get(context, {dbgExpr});
330+
globalOp->setLoc(builder.getFusedLoc({globalOp.getLoc()}, arrayAttr));
231331
}
232332

233333
void AddDebugInfoPass::handleFuncOp(mlir::func::FuncOp funcOp,
@@ -409,6 +509,11 @@ void AddDebugInfoPass::handleFuncOp(mlir::func::FuncOp funcOp,
409509
if (&funcOp.front() == declOp->getBlock())
410510
handleDeclareOp(declOp, fileAttr, spAttr, typeGen, symbolTable);
411511
});
512+
// commonBlockMap ensures that we don't create multiple DICommonBlockAttr of
513+
// the same name in one function. But it is ok (rather required) to create
514+
// them in different functions if common block of the same name has been used
515+
// there.
516+
commonBlockMap.clear();
412517
}
413518

414519
void AddDebugInfoPass::runOnOperation() {
@@ -461,6 +566,13 @@ void AddDebugInfoPass::runOnOperation() {
461566
module.walk([&](mlir::func::FuncOp funcOp) {
462567
handleFuncOp(funcOp, fileAttr, cuAttr, typeGen, &symbolTable);
463568
});
569+
mlir::OpBuilder builder(context);
570+
// We have processed all function. Attach common block variables to the
571+
// global that represent the storage.
572+
for (auto [global, exprs] : globalToGlobalExprsMap) {
573+
auto arrayAttr = mlir::ArrayAttr::get(context, exprs);
574+
global->setLoc(builder.getFusedLoc({global.getLoc()}, arrayAttr));
575+
}
464576
// Process any global which was not processed through DeclareOp.
465577
if (debugLevel == mlir::LLVM::DIEmissionKind::Full) {
466578
// Process 'GlobalOp' only if full debug info is requested.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
! RUN: %flang_fc1 -emit-llvm -debug-info-kind=standalone %s -o - | FileCheck %s
2+
3+
subroutine f1
4+
real(kind=4) :: x, y, xa, ya
5+
common // x, y
6+
common /a/ xa, ya
7+
x = 1.1
8+
y = 2.2
9+
xa = 3.3
10+
ya = 4.4
11+
print *, x, y, xa, ya
12+
end subroutine
13+
! CHECK-DAG: ![[XF1:[0-9]+]] = {{.*}}!DIGlobalVariable(name: "x", linkageName: "_QFf1Ex", scope: ![[CBF1:[0-9]+]], file: !5, line: [[@LINE-9]], type: ![[REAL:[0-9]+]]{{.*}})
14+
! CHECK-DAG: ![[EXPXF1:[0-9]+]] = !DIGlobalVariableExpression(var: ![[XF1]], expr: !DIExpression())
15+
! CHECK-DAG: ![[YF1:[0-9]+]] = {{.*}}!DIGlobalVariable(name: "y", linkageName: "_QFf1Ey", scope: ![[CBF1]], file: !{{[0-9]+}}, line: [[@LINE-11]], type: ![[REAL]]{{.*}})
16+
! CHECK-DAG: ![[EXPYF1:[0-9]+]] = !DIGlobalVariableExpression(var: ![[YF1]], expr: !DIExpression(DW_OP_plus_uconst, 4))
17+
! CHECK-DAG: ![[XAF1:[0-9]+]] = {{.*}}!DIGlobalVariable(name: "xa", linkageName: "_QFf1Exa", scope: ![[CBAF1:[0-9]+]], file: !{{[0-9]+}}, line: [[@LINE-13]], type: ![[REAL]]{{.*}})
18+
! CHECK-DAG: ![[EXPXAF1:[0-9]+]] = !DIGlobalVariableExpression(var: ![[XAF1]], expr: !DIExpression())
19+
! CHECK-DAG: ![[YAF1:[0-9]+]] = {{.*}}!DIGlobalVariable(name: "ya", linkageName: "_QFf1Eya", scope: ![[CBAF1]], file: !{{[0-9]+}}, line: [[@LINE-15]], type: ![[REAL]]{{.*}})
20+
! CHECK-DAG: ![[EXPYAF1:[0-9]+]] = !DIGlobalVariableExpression(var: ![[YAF1]], expr: !DIExpression(DW_OP_plus_uconst, 4))
21+
22+
23+
subroutine f2
24+
real(kind=4) :: x, y, z, xa, ya, za
25+
common // x, y, z
26+
common /a/ xa, ya, za
27+
print *, x, y, z, xa, ya, za
28+
end subroutine
29+
! CHECK-DAG: ![[XF2:[0-9]+]] = {{.*}}!DIGlobalVariable(name: "x", linkageName: "_QFf2Ex", scope: ![[CBF2:[0-9]+]], file: !{{[0-9]+}}, line: [[@LINE-5]], type: ![[REAL]]{{.*}})
30+
! CHECK-DAG: ![[EXPXF2:[0-9]+]] = !DIGlobalVariableExpression(var: ![[XF2]], expr: !DIExpression())
31+
! CHECK-DAG: ![[YF2:[0-9]+]] = {{.*}}!DIGlobalVariable(name: "y", linkageName: "_QFf2Ey", scope: ![[CBF2]], file: !{{[0-9]+}}, line: [[@LINE-7]], type: ![[REAL]]{{.*}})
32+
! CHECK-DAG: ![[EXPYF2:[0-9]+]] = !DIGlobalVariableExpression(var: ![[YF2]], expr: !DIExpression(DW_OP_plus_uconst, 4))
33+
! CHECK-DAG: ![[ZF2:[0-9]+]] = {{.*}}!DIGlobalVariable(name: "z", linkageName: "_QFf2Ez", scope: ![[CBF2]], file: !{{[0-9]+}}, line: [[@LINE-9]], type: ![[REAL]]{{.*}})
34+
! CHECK-DAG: ![[EXPZF2:[0-9]+]] = !DIGlobalVariableExpression(var: ![[ZF2]], expr: !DIExpression(DW_OP_plus_uconst, 8))
35+
! CHECK-DAG: ![[XAF2:[0-9]+]] = {{.*}}!DIGlobalVariable(name: "xa", linkageName: "_QFf2Exa", scope: ![[CBAF2:[0-9]+]], file: !{{[0-9]+}}, line: [[@LINE-11]], type: ![[REAL]]{{.*}})
36+
! CHECK-DAG: ![[EXPXAF2:[0-9]+]] = !DIGlobalVariableExpression(var: ![[XAF2]], expr: !DIExpression())
37+
! CHECK-DAG: ![[YAF2:[0-9]+]] = {{.*}}!DIGlobalVariable(name: "ya", linkageName: "_QFf2Eya", scope: ![[CBAF2]], file: !{{[0-9]+}}, line: [[@LINE-13]], type: ![[REAL]]{{.*}})
38+
! CHECK-DAG: ![[EXPYAF2:[0-9]+]] = !DIGlobalVariableExpression(var: ![[YAF2]], expr: !DIExpression(DW_OP_plus_uconst, 4))
39+
! CHECK-DAG: ![[ZAF2:[0-9]+]] = {{.*}}!DIGlobalVariable(name: "za", linkageName: "_QFf2Eza", scope: ![[CBAF2]], file: !{{[0-9]+}}, line: [[@LINE-15]], type: ![[REAL]]{{.*}})
40+
! CHECK-DAG: ![[EXPZAF2:[0-9]+]] = !DIGlobalVariableExpression(var: ![[ZAF2]], expr: !DIExpression(DW_OP_plus_uconst, 8))
41+
42+
subroutine f3
43+
integer(kind=4) :: x = 42, xa = 42
44+
common // x
45+
common /a/ xa
46+
print *, x
47+
print *, xa
48+
end subroutine
49+
! CHECK-DAG: ![[XF3:[0-9]+]] = {{.*}}!DIGlobalVariable(name: "x", linkageName: "_QFf3Ex", scope: ![[CBF3:[0-9]+]], file: !{{[0-9]+}}, line: [[@LINE-6]], type: ![[INT:[0-9]+]]{{.*}})
50+
! CHECK-DAG: ![[EXPXF3:[0-9]+]] = !DIGlobalVariableExpression(var: ![[XF3]], expr: !DIExpression())
51+
! CHECK-DAG: ![[XAF3:[0-9]+]] = {{.*}}!DIGlobalVariable(name: "xa", linkageName: "_QFf3Exa", scope: ![[CBAF3:[0-9]+]], file: !{{[0-9]+}}, line: [[@LINE-8]], type: ![[INT]]{{.*}})
52+
! CHECK-DAG: ![[EXPXAF3:[0-9]+]] = !DIGlobalVariableExpression(var: ![[XAF3]], expr: !DIExpression())
53+
54+
program test
55+
real(kind=4) :: v1, v2, v3, va1, va2, va3
56+
common // v1, v2, v3
57+
common /a/ va1, va2, va3
58+
call f1()
59+
call f2()
60+
call f3()
61+
print *, v1, va1, va3
62+
END
63+
! CHECK-DAG: ![[V1:[0-9]+]] = {{.*}}!DIGlobalVariable(name: "v1", linkageName: "_QFEv1", scope: ![[CBM:[0-9]+]], file: !{{[0-9]+}}, line: [[@LINE-8]], type: ![[REAL]]{{.*}})
64+
! CHECK-DAG: ![[EXPV1:[0-9]+]] = !DIGlobalVariableExpression(var: ![[V1]], expr: !DIExpression())
65+
! CHECK-DAG: ![[V2:[0-9]+]] = {{.*}}!DIGlobalVariable(name: "v2", linkageName: "_QFEv2", scope: ![[CBM]], file: !{{[0-9]+}}, line: [[@LINE-10]], type: ![[REAL]]{{.*}})
66+
! CHECK-DAG: ![[EXPV2:[0-9]+]] = !DIGlobalVariableExpression(var: ![[V2]], expr: !DIExpression(DW_OP_plus_uconst, 4))
67+
! CHECK-DAG: ![[V3:[0-9]+]] = {{.*}}!DIGlobalVariable(name: "v3", linkageName: "_QFEv3", scope: ![[CBM]], file: !{{[0-9]+}}, line: [[@LINE-12]], type: ![[REAL]]{{.*}})
68+
! CHECK-DAG: ![[EXPV3:[0-9]+]] = !DIGlobalVariableExpression(var: ![[V3]], expr: !DIExpression(DW_OP_plus_uconst, 8))
69+
! CHECK-DAG: ![[VA1:[0-9]+]] = {{.*}}!DIGlobalVariable(name: "va1", linkageName: "_QFEva1", scope: ![[CBAM:[0-9]+]], file: !{{[0-9]+}}, line: [[@LINE-14]], type: ![[REAL]]{{.*}})
70+
! CHECK-DAG: ![[EXPVA1:[0-9]+]] = !DIGlobalVariableExpression(var: ![[VA1]], expr: !DIExpression())
71+
! CHECK-DAG: ![[VA2:[0-9]+]] = {{.*}}!DIGlobalVariable(name: "va2", linkageName: "_QFEva2", scope: ![[CBAM]], file: !{{[0-9]+}}, line: [[@LINE-16]], type: ![[REAL]]{{.*}})
72+
! CHECK-DAG: ![[EXPVA2:[0-9]+]] = !DIGlobalVariableExpression(var: ![[VA2]], expr: !DIExpression(DW_OP_plus_uconst, 4))
73+
! CHECK-DAG: ![[VA3:[0-9]+]] = {{.*}}!DIGlobalVariable(name: "va3", linkageName: "_QFEva3", scope: ![[CBAM]], file: !{{[0-9]+}}, line: [[@LINE-18]], type: ![[REAL]]{{.*}})
74+
! CHECK-DAG: ![[EXPVA3:[0-9]+]] = !DIGlobalVariableExpression(var: ![[VA3]], expr: !DIExpression(DW_OP_plus_uconst, 8))
75+
76+
77+
! CHECK-DAG: ![[REAL]] = !DIBasicType(name: "real", size: 32, encoding: DW_ATE_float)
78+
! CHECK-DAG: ![[INT]] = !DIBasicType(name: "integer", size: 32, encoding: DW_ATE_signed)
79+
80+
! CHECK-DAG: ![[F1:[0-9]+]] = {{.*}}!DISubprogram(name: "f1"{{.*}})
81+
! CHECK-DAG: ![[CBF1]] = !DICommonBlock(scope: ![[F1]], declaration: null, name: "__BLNK__"{{.*}})
82+
! CHECK-DAG: ![[CBAF1]] = !DICommonBlock(scope: ![[F1]], declaration: null, name: "a"{{.*}})
83+
84+
! CHECK-DAG: ![[F2:[0-9]+]] = {{.*}}!DISubprogram(name: "f2"{{.*}})
85+
! CHECK-DAG: ![[CBF2]] = !DICommonBlock(scope: ![[F2]], declaration: null, name: "__BLNK__"{{.*}})
86+
! CHECK-DAG: ![[CBAF2]] = !DICommonBlock(scope: ![[F2]], declaration: null, name: "a"{{.*}})
87+
88+
! CHECK-DAG: ![[F3:[0-9]+]] = {{.*}}!DISubprogram(name: "f3"{{.*}})
89+
! CHECK-DAG: ![[CBF3]] = !DICommonBlock(scope: ![[F3]], declaration: null, name: "__BLNK__"{{.*}})
90+
! CHECK-DAG: ![[CBAF3]] = !DICommonBlock(scope: ![[F3]], declaration: null, name: "a"{{.*}})
91+
92+
! CHECK-DAG: ![[MAIN:[0-9]+]] = {{.*}}!DISubprogram(name: "test"{{.*}})
93+
! CHECK-DAG: ![[CBM]] = !DICommonBlock(scope: ![[MAIN]], declaration: null, name: "__BLNK__"{{.*}})
94+
! CHECK-DAG: ![[CBAM]] = !DICommonBlock(scope: ![[MAIN]], declaration: null, name: "a"{{.*}})
95+
96+
! Using CHECK-DAG-SAME so that we are not dependent on order of variable in these lists.
97+
! CHECK-DAG: @__BLNK__ = global{{.*}}
98+
! CHECK-DAG-SAME: !dbg ![[EXPXF1]]
99+
! CHECK-DAG-SAME: !dbg ![[EXPYF1]]
100+
! CHECK-DAG-SAME: !dbg ![[EXPXF2]]
101+
! CHECK-DAG-SAME: !dbg ![[EXPYF2]]
102+
! CHECK-DAG-SAME: !dbg ![[EXPZF2]]
103+
! CHECK-DAG-SAME: !dbg ![[EXPXF3]]
104+
! CHECK-DAG-SAME: !dbg ![[EXPV1]]
105+
! CHECK-DAG-SAME: !dbg ![[EXPV2]]
106+
! CHECK-DAG-SAME: !dbg ![[EXPV3]]
107+
108+
! CHECK-DAG: @a_ = global{{.*}}
109+
! CHECK-DAG-SAME: !dbg ![[EXPXAF1]]
110+
! CHECK-DAG-SAME: !dbg ![[EXPYAF1]]
111+
! CHECK-DAG-SAME: !dbg ![[EXPXAF2]]
112+
! CHECK-DAG-SAME: !dbg ![[EXPYAF2]]
113+
! CHECK-DAG-SAME: !dbg ![[EXPZAF2]]
114+
! CHECK-DAG-SAME: !dbg ![[EXPXAF3]]
115+
! CHECK-DAG-SAME: !dbg ![[EXPVA1]]
116+
! CHECK-DAG-SAME: !dbg ![[EXPVA2]]
117+
! CHECK-DAG-SAME: !dbg ![[EXPVA3]]
118+
119+
! CHECK-DAG: !DICompileUnit({{.*}}, globals: ![[GLOBALS:[0-9]+]])
120+
! CHECK-DAG: ![[GLOBALS]]
121+
! CHECK-DAG-SAME: ![[EXPXF1]]
122+
! CHECK-DAG-SAME: ![[EXPYF1]]
123+
! CHECK-DAG-SAME: ![[EXPXAF1]]
124+
! CHECK-DAG-SAME: ![[EXPYAF1]]
125+
! CHECK-DAG-SAME: ![[EXPXF2]]
126+
! CHECK-DAG-SAME: ![[EXPYF2]]
127+
! CHECK-DAG-SAME: ![[EXPZF2]]
128+
! CHECK-DAG-SAME: ![[EXPXAF2]]
129+
! CHECK-DAG-SAME: ![[EXPYAF2]]
130+
! CHECK-DAG-SAME: ![[EXPZAF2]]
131+
! CHECK-DAG-SAME: ![[EXPXF3]]
132+
! CHECK-DAG-SAME: ![[EXPXAF3]]
133+
! CHECK-DAG-SAME: ![[EXPV1]]
134+
! CHECK-DAG-SAME: ![[EXPV2]]
135+
! CHECK-DAG-SAME: ![[EXPV3]]
136+
! CHECK-DAG-SAME: ![[EXPVA1]]
137+
! CHECK-DAG-SAME: ![[EXPVA2]]
138+
! CHECK-DAG-SAME: ![[EXPVA3]]

0 commit comments

Comments
 (0)