Suggested patch to opt-viewer

I’m an LLVM user, not developer - but I did see Adam Nemet’s 2016 talk on opt-viewer, gave it a try and thought that with little tweaks it could be very useful to me and other general devs.
The main gap is improving SnR, as (unlike LLVM pass developers debugging their own work) I don’t care about the vast majority of optimization remarks. I care only about missed optimizations, and of those - only about the subset that is potentially actionable to me (these are more or less inlining remarks, gvn’s aliasing remark ‘clobbered by store’, escape remark ‘clobbered by call’ and some licm remarks). So I forked the opt-viewer python scripts and started hacking away on them. I:

  1. dropped !passed and !info remarks,
  2. dropped remarks from system (== out-of-source-root) headers,
  3. enabled filtering of remarks by name or text via command line or config file.

Moreover, the opt-viewer script could easily consume ~100G of ram while forming the index table of a ~2000 file project, so I -
4. added a split-top-folder switch, to create separate indices.
5. rewrote the index table, to (among others) allow partial display of large index pages. (with help from Ilan Ben-Hagai).

All additions except (5) can fall back to old behavior via switches.

The project is available here, and soon a talk I gave about it at CppOnSea would be made available.
I didn’t think this would be of interest to LLVM devs, but recently - both at the conference and here on discourse - it was suggested that it might be. At this point I’m fairly confident in saying that these changes do add value to clang users.

Would you consider merging a patch with this? Should I submit one?

@fhahn @banach-space

Hi & sorry for the long delay!

I saw you uploaded ⚙ D131518 Make opt-viewer more usable by general developers - part 1/N which is a great first step, thank you very much. I left a few initial comments and it would also be great if you could split the patch up in separate reviews, to make it a bit easier for the reviewers.

I’m thrilled to see usuability improvements in this area!