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

Fix parsing out-of-order ValueInfos #73239

Merged
merged 1 commit into from
Dec 5, 2023

Conversation

eleviant
Copy link
Contributor

C++ class type info has two entries in summary index: gv and typeidCompatibleVTable, both sharing the same GUID. This causes value numbers being non-sequential


^0 = module: (path: "thinlto-typeid.ll", hash: (0, 0, 0, 0, 0))
^1 = gv: (name: "_ZTVN3FooE", summaries: (variable: (module: ^0, flags: (linkage: internal, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 1, canAutoHide: 0), varFlags: (readonly: 1, writeonly: 0, constant: 1, vcall_visibility: 0), vTableFuncs: ((virtFunc: ^3, offset: 16)))))
^4 = gv: (name: "_ZTSN3FooE", summaries: (variable: (module: ^0, flags: (linkage: linkonce_odr, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), varFlags: (readonly: 0, writeonly: 0, constant: 1))))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this actually a bug on the assembly printer side? I.e. this should be ^2, I don't think it makes sense to print two summaries with the same identifier.

@cachemeifyoucan
Copy link
Collaborator

I am not really familiar with devirtualization part of the summary but is the real bug that there should not be two ^4 in the same module?

Maybe we should correctly error out instead of assertion in this case.

@eleviant
Copy link
Contributor Author

I am not really familiar with devirtualization part of the summary but is the real bug that there should not be two ^4 in the same module?

Maybe we should correctly error out instead of assertion in this case.

This might be a bug (actually I think the problem is in one-guid-one-id approach in asm printer). However it seems that asm parser also contains a bug, because it can't really handle out of order ids.

@teresajohnson
Copy link
Contributor

I am not really familiar with devirtualization part of the summary but is the real bug that there should not be two ^4 in the same module?
Maybe we should correctly error out instead of assertion in this case.

This might be a bug (actually I think the problem is in one-guid-one-id approach in asm printer). However it seems that asm parser also contains a bug, because it can't really handle out of order ids.

I just sent #73997 for the fix to the AsmWriter.

I agree, though, that it would be good to make the parser more flexible to handle out of order ids. I think your change also handles that case (i.e. non-repeated but simply out of order ids). Can you update this patch to reflect that it is just for that issue, and the test case as well?

@eleviant
Copy link
Contributor Author

eleviant commented Dec 1, 2023

Addressed comments

Copy link
Contributor

@teresajohnson teresajohnson left a comment

Choose a reason for hiding this comment

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

Thanks! Please update the patch description before committing. A couple minor requests for the test below too.

@@ -0,0 +1,24 @@
; RUN: llvm-as %s -o - | llvm-dis -o - | FileCheck %s

; CHECK: ^1 = gv:
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally the test would also ensure that the references between the renumbered entries are correct.

@@ -0,0 +1,24 @@
; RUN: llvm-as %s -o - | llvm-dis -o - | FileCheck %s
Copy link
Contributor

Choose a reason for hiding this comment

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

Add short description of what is being tested at top

C++ class type info has two entries in summary index: gv and
typeidCompatibleVTable, both sharing the same GUID. This causes
value numbers being non-sequential
@eleviant
Copy link
Contributor Author

eleviant commented Dec 4, 2023

Addressed comments

@eleviant eleviant merged commit 432bb52 into llvm:main Dec 5, 2023
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants