This is an archive of the discontinued LLVM Phabricator instance.

[AsmPrinter] fix -disable-debug-info option
ClosedPublic

Authored by vtjnash on Nov 9 2020, 8:00 AM.

Details

Summary

This option was in a rather convoluted place, causing global parameters
to be set in awkward and undesirable ways to try to account for it
indirectly. Add tests for the -disable-debug-info option and ensure we
don't print unintended markers from unintended places.

Diff Detail

Event Timeline

vtjnash created this revision.Nov 9 2020, 8:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 9 2020, 8:00 AM
vtjnash requested review of this revision.Nov 9 2020, 8:00 AM

Thanks! The problem I saw is fixed with this patch.

@dstenb : Any opinions about this?

dstenb accepted this revision.Nov 12 2020, 2:15 AM

Thanks! This looks good to me.

Since the option is now moved into AsmPrinter, can you add a FIXME comment to clarify that the option does (still) not work when emitting CodeView? E.g. at line 320.

This revision is now accepted and ready to land.Nov 12 2020, 2:15 AM
This revision was landed with ongoing or failed builds.Nov 12 2020, 9:59 PM
This revision was automatically updated to reflect the committed changes.
hans added a subscriber: hans.Nov 13 2020, 4:51 AM

The test fails on Mac, see e.g. https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8863756117615904432/+/steps/package_clang/0/stdout

The output of the first run line is:

$ bin/llc -disable-debug-info-print=true -exception-model=dwarf -o - ../llvm/test/CodeGen/Generic/disable-debug-info-print.ll
        .section        __TEXT,__text,regular,pure_instructions
        .build_version macos, 10, 15
        .globl  _main                           ## -- Begin function main
        .p2align        4, 0x90
_main:                                  ## @main
## %bb.0:                               ## %entry
        xorl    %eax, %eax
        retq
                                        ## -- End function
        .globl  _helper                         ## -- Begin function helper
        .p2align        4, 0x90
_helper:                                ## @helper
        .cfi_startproc
## %bb.0:                               ## %entry
        xorl    %eax, %eax
        retq
        .cfi_endproc
                                        ## -- End function
.subsections_via_symbols

Note that the .file directive which the test checks for isn't there.

The failure is probably reproducible by passing a -mtriple=darwin something to llc.

I've reverted in 105ed27ed80dd47a9d32e72bbdd2a776a3318f38 in the meantime.

Thanks for identifying that. I think I can re-land just without that part of the test. It is not essential, I added it just to try to check all of the dwarf-related output.

hans added a comment.Nov 16 2020, 6:10 AM

Thanks for identifying that. I think I can re-land just without that part of the test. It is not essential, I added it just to try to check all of the dwarf-related output.

Sounds good to me, as long as it passes :)