Skip to content

Commit 581243b

Browse files
committed
1 parent 6558115 commit 581243b

File tree

2 files changed

+64
-1
lines changed

2 files changed

+64
-1
lines changed

llvm/lib/CodeGen/MIRParser/MIParser.cpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2329,6 +2329,8 @@ bool MIParser::parseDILocation(MDNode *&Loc) {
23292329
MDNode *Scope = nullptr;
23302330
MDNode *InlinedAt = nullptr;
23312331
bool ImplicitCode = false;
2332+
uint64_t AtomGroup = 0;
2333+
uint64_t AtomRank = 0;
23322334

23332335
if (expectAndConsume(MIToken::lparen))
23342336
return true;
@@ -2403,6 +2405,28 @@ bool MIParser::parseDILocation(MDNode *&Loc) {
24032405
lex();
24042406
continue;
24052407
}
2408+
if (Token.stringValue() == "atomGroup") {
2409+
lex();
2410+
if (expectAndConsume(MIToken::colon))
2411+
return true;
2412+
if (Token.isNot(MIToken::IntegerLiteral) ||
2413+
Token.integerValue().isSigned())
2414+
return error("expected unsigned integer");
2415+
AtomGroup = Token.integerValue().getZExtValue();
2416+
lex();
2417+
continue;
2418+
}
2419+
if (Token.stringValue() == "atomRank") {
2420+
lex();
2421+
if (expectAndConsume(MIToken::colon))
2422+
return true;
2423+
if (Token.isNot(MIToken::IntegerLiteral) ||
2424+
Token.integerValue().isSigned())
2425+
return error("expected unsigned integer");
2426+
AtomRank = Token.integerValue().getZExtValue();
2427+
lex();
2428+
continue;
2429+
}
24062430
}
24072431
return error(Twine("invalid DILocation argument '") +
24082432
Token.stringValue() + "'");
@@ -2418,7 +2442,7 @@ bool MIParser::parseDILocation(MDNode *&Loc) {
24182442
return error("DILocation requires a scope");
24192443

24202444
Loc = DILocation::get(MF.getFunction().getContext(), Line, Column, Scope,
2421-
InlinedAt, ImplicitCode);
2445+
InlinedAt, ImplicitCode, AtomGroup, AtomRank);
24222446
return false;
24232447
}
24242448

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# RUN: llc %s --run-pass=none -o - | FileCheck %s
2+
3+
## Check the MIR parser understands atomGroup and atomRank.
4+
5+
# CHECK: RET64 $eax, debug-location !DILocation(line: 2, scope: ![[#]], atomGroup: 1, atomRank: 2)
6+
7+
--- |
8+
target triple = "x86_64-unknown-linux-gnu"
9+
define hidden noundef i32 @p() local_unnamed_addr !dbg !5 {
10+
entry:
11+
ret i32 0
12+
}
13+
14+
declare void @_Z12prologue_endv() local_unnamed_addr
15+
16+
!llvm.dbg.cu = !{!0}
17+
!llvm.module.flags = !{!2, !3}
18+
!llvm.ident = !{!4}
19+
20+
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_17, file: !1, producer: "clang version 19.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, splitDebugInlining: false, nameTableKind: None)
21+
!1 = !DIFile(filename: "test.cpp", directory: "/")
22+
!2 = !{i32 7, !"Dwarf Version", i32 5}
23+
!3 = !{i32 2, !"Debug Info Version", i32 3}
24+
!4 = !{!"clang version 19.0.0"}
25+
!5 = distinct !DISubprogram(name: "p", scope: !1, file: !1, line: 1, type: !6, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)
26+
!6 = !DISubroutineType(types: !7)
27+
!7 = !{}
28+
29+
...
30+
---
31+
name: p
32+
alignment: 16
33+
body: |
34+
bb.0.entry:
35+
liveins: $edx, $esi, $rbp, $rbx
36+
renamable $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags
37+
RET64 $eax, debug-location !DILocation(line: 2, scope: !5, atomGroup: 1, atomRank: 2)
38+
39+
...

0 commit comments

Comments
 (0)