This is an archive of the discontinued LLVM Phabricator instance.

[DWARF] Standardize checks and remove verbose where possible in DWARF tests
ClosedPublic

Authored by Jake-Egan on Oct 27 2021, 10:32 AM.

Details

Summary

This patch removes the verbose option from tests that do not need it and simplifies the checks. For tests that do have the verbose option, the checks were standardized to be more readable and consistent.

Diff Detail

Event Timeline

Jake-Egan requested review of this revision.Oct 27 2021, 10:32 AM
Jake-Egan created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptOct 27 2021, 10:32 AM
Jake-Egan edited the summary of this revision. (Show Details)Oct 27 2021, 10:36 AM
Jake-Egan added reviewers: shchenz, dblaikie.
Jake-Egan edited the summary of this revision. (Show Details)

Here is an example for the differing output with file llvm/test/DebugInfo/Generic/varargs.ll

On Linux:

DW_AT_name [DW_FORM_strp]^I( .debug_str[0x00000065] = "a")$

On AIX:

DW_AT_name [DW_FORM_string]^I("a")$
dblaikie accepted this revision.Oct 27 2021, 2:46 PM

I'd be OK with this patch as-is, but if you're up for some other cleanup some tests might be able to be changed to not use -v, and those that can't could probably be a bit more standardized/made more consistent by dropping the sometimes-present trailing ) (since it's unmatched anyway (being consumed by the regex) I think it reduces readability) and including a space between the tag name and the regex in all these cases/consistently.

llvm/test/DebugInfo/Generic/PR20038.ll
4

Some tests may be simplified by removing -v if the test isn't trying to test particular forms/encodings - that way you wouldn't need the {{.*}} either, since the non-verbose form doesn't print the encoding information (you'd need to add () around the string instead, possibly, though).

llvm/test/DebugInfo/Generic/containing-type-extension.ll
8

Could you drop trailing ) from cases like this too?

llvm/test/DebugInfo/Generic/namespace.ll
19

Might be worth standardizing on including a space between DW_AT_name and the {{... part.

This revision is now accepted and ready to land.Oct 27 2021, 2:46 PM
shchenz accepted this revision.Oct 27 2021, 5:35 PM

LGTM as long as @dblaikie comments are addressed.

I think it is still worth investigating why llvm-dwarfdump emits tab instead of whitespace on AIX as a follow-up.

LGTM as long as @dblaikie comments are addressed.

I think it is still worth investigating why llvm-dwarfdump emits tab instead of whitespace on AIX as a follow-up.

I think that got covered somewhere. It's that AIX uses direct rather than indirect strings, so they dump differently when using verbose dumping (verbose is used in some tests where it isn't needed because it was the default, so when the non-verbose behavior was added existing tests often got -v added to make them keep working rather than rewriting them to use the non-verbose output):

Direct string verbose dumping:

DW_AT_name [DW_FORM_string]     ("f")

Indirect string verbose dumping:

DW_AT_name [DW_FORM_strp]       ( .debug_str[0x0000009f] = "f")

So they both have tabs (between the ] and the () but the indirect also has some spaces, and doesn't have a paren immediately before the ".

I think in cases where we don't care about the form for the string, then DW_AT_name {{.*}}"x" is probably the most legible (ideally any test that can be moved away from using verbose output when they don't need it would be ideal - but that's more work, and a reasonable intermediate change to unblock AIX is to at least standardize the probelmatic/overly constrained string testing on this form-agnostic syntax)

Jake-Egan updated this revision to Diff 383375.Oct 29 2021, 8:42 AM
Jake-Egan edited the summary of this revision. (Show Details)

Thanks for the review. I updated the patch with the requested changes.

Jake-Egan retitled this revision from [DWARF] Adjust DW_AT_name/DW_AT_linkage_name checks to [DWARF] Standardize checks and remove verbose where possible in DWARF tests.Oct 29 2021, 8:48 AM
Jake-Egan edited the summary of this revision. (Show Details)
Jake-Egan marked 3 inline comments as done.Oct 29 2021, 8:52 AM
Jake-Egan edited the summary of this revision. (Show Details)
dblaikie accepted this revision.Oct 29 2021, 2:12 PM

Looks great, thanks a lot for all the cleanup!