Optimize metadata node fields for CHECK-ability
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sat, 28 Feb 2015 23:21:38 +0000 (23:21 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sat, 28 Feb 2015 23:21:38 +0000 (23:21 +0000)
commit16d182acb90592983d6a0f1c9080685a86f3a4b5
tree2bcbfbf64fe35363289f70de0ee43ca7655e9a8c
parent1c3eaecc09252d4ef977344d9499758185536847
Optimize metadata node fields for CHECK-ability

While gaining practical experience hand-updating CHECK lines (for moving
the new debug info hierarchy into place),  I learnt a few things about
CHECK-ability of the specialized node assembly output.

  - The first part of a `CHECK:` is to identify the "right" node (this
    is especially true if you intend to use the new `CHECK-SAME`
    feature, since the first CHECK needs to identify the node correctly
    before you can split the line).
      - If there's a `tag:`, it should go first.
      - If there's a `name:`, it should go next (followed by the
        `linkageName:`, if any).
      - If there's a `scope:`, it should follow after that.
  - When a node type supports multiple DW_TAGs, but one is implied by
    its name and is overwhelmingly more common, the `tag:` field is
    terribly uninteresting unless it's different.
      - `MDBasicType` is almost always `DW_TAG_base_type`.
      - `MDTemplateValueParameter` is almost always
        `DW_TAG_template_value_parameter`.
  - Printing `name: ""` doesn't improve CHECK-ability, and there are far
    more nodes than I realized that are commonly nameless.
  - There are a few other fields that similarly aren't very interesting
    when they're empty.

This commit updates the `AsmWriter` as suggested above (and makes
necessary changes in `LLParser` for round-tripping).

llvm-svn: 230877
13 files changed:
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/IR/AsmWriter.cpp
llvm/test/Assembler/debug-info.ll
llvm/test/Assembler/invalid-mdbasictype-missing-tag.ll [deleted file]
llvm/test/Assembler/invalid-mdtemplatevalueparameter-missing-tag.ll [deleted file]
llvm/test/Assembler/invalid-mdtemplatevalueparameter-missing-type.ll [deleted file]
llvm/test/Assembler/mdglobalvariable.ll
llvm/test/Assembler/mdimportedentity.ll
llvm/test/Assembler/mdlocalvariable.ll
llvm/test/Assembler/mdnamespace.ll
llvm/test/Assembler/mdsubprogram.ll
llvm/test/Assembler/mdtemplateparameter.ll
llvm/test/Assembler/mdtype-large-values.ll