Skip to content

Commit 3593b5b

Browse files
Evgeny LeviantEvgeny Leviant
Evgeny Leviant
authored and
Evgeny Leviant
committed
[llvm-as] Fix assembling of index with multiple summaries sharing single GUID
Differential revision: https://reviews.llvm.org/D73091
1 parent a133cba commit 3593b5b

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

llvm/lib/AsmParser/LLParser.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8040,12 +8040,10 @@ bool LLParser::ParseGVEntry(unsigned ID) {
80408040

80418041
// Have a list of summaries
80428042
if (ParseToken(lltok::kw_summaries, "expected 'summaries' here") ||
8043-
ParseToken(lltok::colon, "expected ':' here"))
8043+
ParseToken(lltok::colon, "expected ':' here") ||
8044+
ParseToken(lltok::lparen, "expected '(' here"))
80448045
return true;
8045-
80468046
do {
8047-
if (ParseToken(lltok::lparen, "expected '(' here"))
8048-
return true;
80498047
switch (Lex.getKind()) {
80508048
case lltok::kw_function:
80518049
if (ParseFunctionSummary(Name, GUID, ID))
@@ -8062,11 +8060,10 @@ bool LLParser::ParseGVEntry(unsigned ID) {
80628060
default:
80638061
return Error(Lex.getLoc(), "expected summary type");
80648062
}
8065-
if (ParseToken(lltok::rparen, "expected ')' here"))
8066-
return true;
80678063
} while (EatIfPresent(lltok::comma));
80688064

8069-
if (ParseToken(lltok::rparen, "expected ')' here"))
8065+
if (ParseToken(lltok::rparen, "expected ')' here") ||
8066+
ParseToken(lltok::rparen, "expected ')' here"))
80708067
return true;
80718068

80728069
return false;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
; Checks that llvm-as/llvm-dis correctly assembles/disassembles index with
2+
; multiple summaries with single GUID.
3+
; RUN: llvm-as %s -o - | llvm-dis -o - | FileCheck %s
4+
5+
source_filename = "index.bc"
6+
7+
^0 = module: (path: "main.bc", hash: (3499594384, 1671013073, 3271036935, 1830411232, 59290952))
8+
; CHECK: ^0 = module: (path: "main.bc", hash: (3499594384, 1671013073, 3271036935, 1830411232, 59290952))
9+
^1 = module: (path: "[Regular LTO]", hash: (0, 0, 0, 0, 0))
10+
; CHECK-NEXT: ^1 = module: (path: "[Regular LTO]", hash: (0, 0, 0, 0, 0))
11+
^2 = gv: (guid: 13351721993301222997, summaries: (function: (module: ^0, flags: (linkage: linkonce_odr, notEligibleToImport: 0, live: 1, dsoLocal: 1, canAutoHide: 1), insts: 1), function: (module: ^1, flags: (linkage: available_externally, notEligibleToImport: 1, live: 1, dsoLocal: 1, canAutoHide: 0), insts: 1)))
12+
; CHECK-NEXT: ^2 = gv: (guid: 13351721993301222997, summaries: (function: (module: ^0, flags: (linkage: linkonce_odr, notEligibleToImport: 0, live: 1, dsoLocal: 1, canAutoHide: 1), insts: 1), function: (module: ^1, flags: (linkage: available_externally, notEligibleToImport: 1, live: 1, dsoLocal: 1, canAutoHide: 0), insts: 1)))

0 commit comments

Comments
 (0)