Lots of passes operate by making incremental changes to a function: instcombine iterates through a worklist, mem2reg promotes allocas one at a time, and the inliner inlines a function one at a time. Before and after each transformation, the IR is valid, and could be snapshotted. It would be really awesome to expose this behavior through to the passmanager to allow the verifier to be run after each transaction and for bugpoint to be able to reduce bugs down to the level of a single transaction.
I haven't thought fully about how this would work, but it seems that a pass should be able to opt-in to the transaction system. Each time it does something, it should bump the per-pass counter (which is owned/maintained by the passmgr) and before it does a transaction it checks some counter or something. If the counter is reaches zero, then it stops making transformations.
This is a fairly large and open ended project, but would be incredibly valuable for tracking down nasty bugs, particularly miscompilations.
The text was updated successfully, but these errors were encountered:
Is this something we still want to do? It looks like we could get most of the benefit by just doing something like IfCvtLimit. That is, add a debug command line option -max-transforms that each pass can check to see how many inlines, if conversions, alloca promotions, etc it should do.
If bugpoint gets down to a single pass, it can try "-max-transforms 0" to see if that pass supports limiting the amount of work it does.