[PATCH] D67495: [RISCV] Collect Statistics on Compressed Instructions

Sam Elliott via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 03:40:49 PST 2020


lenary added a comment.

In D67495#1800935 <https://reviews.llvm.org/D67495#1800935>, @luismarques wrote:

> LGTM. My only concern was if it made sense to use the same statistic to count in both places, and if we could end up double counting the instructions emitted (now, or in a future LLVM version). After a quick look I didn't really see other targets using the same approach, but I also can't think of a way where this ends up actually being problematic.


My understanding is that instructions only go through one of these functions. `RISCVAsmParser.cpp` is used by the assembler only, and the `RISCVAsmPrinter.cpp` is only used by LLVM CodeGen. This should mean that instructions are not double-counted (today). Yes I'm not sure why we have both, I think @asb did this to ensure better layering.

Note, the statistics are not the same. Statistics are namespaced by `DEBUG_TYPE`, which is why I had to define it in `RISCVAsmParser.cpp`.

> (Nipick: maybe put a comment in the statistic reminding people that the linker may further compress some of the instructions we emitted uncompressed?)

The point in these statistics is to track how good LLVM is at compressing instructions (which may change depending on optimisation heuristics we implement eventually). I don't see this as being used by end users much, if at all.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67495/new/

https://reviews.llvm.org/D67495





More information about the llvm-commits mailing list