This is a new patch for the optimization bisect feature, which will allow optimizations to be selectively disabled at compile time in order to track down test failures that are caused by incorrect optimizations.
My previous patch (D18576) proposed adding new methods to the Pass base class (and various templates for the new pass manager) to allow the OptBisect object to query whether or not a pass is skippable with the bisection being initiated from within the various pass managers. During the review, an alternate approach was suggested, to be based on the function optnone handling, whereby each skippable pass would opt in to the bisection process at the start of its run routine. This patch implements that alternate approach.
For function, loop and basic block passes, I am replacing the existing calls to "skipOptnoneFunction()" with a call to a new function that checks the opt bisect limit as well as the optnone attribute. For the most part I treated the presence or absence of an existing call to skipOptnoneFunction() as an indication of whether or not the pass could be skipped. There were three passes that were not calling skipOptnoneFunction() that seemed to me as if they should, so I added the call. Those passes were:
There was no equivalent mechanism for module passes and SCC passes. For these passes, I attempted to discern whether or not the pass was skippable and added calls to the appropriate function to check the bisect limit. The passes I chose to treat as skippable can be seen in the code changes in this review. Those that I determined were not skippable do not show up here, so it seems worth noting the module and SCC passes I considered to be non-skippable. Here's the list:
There was also no optnone equivalent for region passes. However, since the only region passes in the LLVM code base (StructuralizeCFG, PrinRegionPass and RegionPassPrinter) would have been non-skippable, it seemed best to omit any handling for region passes at this time. If anyone has region passes which should be included in the bisection, it will be a simple matter to add such support.