[PATCH] D112940: Add a tool for diffing instruction count + stack size remarks

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 1 11:02:20 PDT 2021


paquette created this revision.
paquette added reviewers: thegameg, fhahn.
Herald added subscribers: rupprecht, mgorny.
Herald added a reviewer: jhenderson.
paquette requested review of this revision.
Herald added a subscriber: MaskRay.
Herald added a project: LLVM.

This is a tool which can handle bitstream and YAML remarks. The idea here is to provide more insight into which functions changed in a benchmark when testing compiler changes.

E.g. "foo got 20% bigger, so maybe we should look more closely at that."

To use the tool, you can use...

  $ llvm-size-diff remarks_file_a remarks_file_b --parser=yaml|bitstream

... on two remarks files containing at least instruction count remarks. This will output some data on instruction count change and also other relevant information such as stack size change from `remarks_file_a` to `remarks_file_b`.

This is a bit of a WIP so I'm happy to change the format etc. Ultimately I think it'd be best to have some JSON output which could be consumed by another tool. But some base-level, greppable output is very handy to have anyway.

The format I'm proposing here is

  <which files?> <increase/decrease in instruction count?> <function name> <inst count change> <stack B change>

Where the files and increase/decrease are indicated like below:

- `<which files>` is one of `++` (file B), `--` (file A), `==` (both)
- `<increase/decrease in instruction count?>` is one of `>` (increase) or `<` (decrease)

This makes it easy to grep for things like "which functions appeared in A but did not appear in B?" Or "what are all the instruction count decreases?"


https://reviews.llvm.org/D112940

Files:
  llvm/test/tools/llvm-size-diff/Inputs/1-func-1-instr-1-stack.yaml
  llvm/test/tools/llvm-size-diff/Inputs/1-func-2-instr-2-stack.yaml
  llvm/test/tools/llvm-size-diff/Inputs/2-identical-func-1-instr-1-stack.yaml
  llvm/test/tools/llvm-size-diff/Inputs/empty-file.yaml
  llvm/test/tools/llvm-size-diff/Inputs/inconvertible-integer.yaml
  llvm/test/tools/llvm-size-diff/Inputs/no-instruction-count-remarks.yaml
  llvm/test/tools/llvm-size-diff/Inputs/unexpected-key.yaml
  llvm/test/tools/llvm-size-diff/add-remove-func.test
  llvm/test/tools/llvm-size-diff/empty-file.test
  llvm/test/tools/llvm-size-diff/inconvertible-integer.test
  llvm/test/tools/llvm-size-diff/increase-decrease-inst-count.test
  llvm/test/tools/llvm-size-diff/no-difference.test
  llvm/test/tools/llvm-size-diff/no-instruction-count-remarks.test
  llvm/test/tools/llvm-size-diff/unexpected-key.test
  llvm/tools/llvm-size-diff/CMakeLists.txt
  llvm/tools/llvm-size-diff/SizeDiff.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112940.383836.patch
Type: text/x-patch
Size: 25225 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211101/bd8aa7d7/attachment.bin>


More information about the llvm-commits mailing list