opt's -analyze feature and NPM

opt has a flag -analyze which prints some debug information for analyses that are run. This is done via Pass::print() within the pass manager.

This isn’t implemented in NPM and since NPM is not so much into subclassing, it’s a bit awkward (but somewhat doable) to implement. Probably a better alternative is to separate out the debug printing into a flag, or into another pass. For example, some tests in Analysis/RegionInfo run opt -regions -analyze for LPM, and opt -passes='print<regions>' to test under NPM.

This is responsible for a significant amount of the remaining check-llvm failures under NPM. I’d like to deprecate -analyze and migrate passes to either use a separate flag or pass to print extra info. Any comments?

One tricky part about this is the existence of update_analyze_test_checks.py. It uses some of the logs printed (per function) by the -analyze infra to help with updating CHECK lines. This is only used in ScalarEvolution and CostModel tests. If we decide to separate out the -analyze printing for those passes into a separate flag/pass, we could make those two passes mimic -analyze’s logging to continue being able to use update_analyze_test_checks.py if that’s really wanted.

opt has a flag -analyze which prints some debug information for analyses that are run. This is done via Pass::print() within the pass manager.

This isn't implemented in NPM and since NPM is not so much into subclassing, it's a bit awkward (but somewhat doable) to implement. Probably a better alternative is to separate out the debug printing into a flag, or into another pass. For example, some tests in Analysis/RegionInfo run `opt -regions -analyze` for LPM, and `opt -passes='print<regions>'` to test under NPM.

This is responsible for a significant amount of the remaining check-llvm failures under NPM <https://bugs.llvm.org/show_bug.cgi?id=46651>. I'd like to deprecate -analyze and migrate passes to either use a separate flag or pass to print extra info. Any comments?

I think that, whatever the mechanism, we should make it uniform across the passes. print<regions>, print<scev>, print<cost-model> (or whatever) seems fine to me.

-Hal