Page MenuHomePhabricator

[NewPM] -print-module-scope -print-after now prints module even after invalidated Loop/SCC
Needs ReviewPublic

Authored by fedor.sergeev on Tue, Dec 4, 8:46 AM.

Details

Summary

-print-after IR printing generally can not print the IR unit (Loop or SCC) which has just been invalidated by the pass.
However, when working in -print-module-scope mode even if Loop was invalidated there is still a valid module
that we can print.

Since we can not access invalidated IR unit from AfterPassInvalidated instrumentation point we can remember
the module to be printed *before* pass. This change introduces BeforePass instrumentation that stores all the
information required for module printing into the stack and then after pass (in AfterPassInvalidated) just print
whatever has been placed on stack.

Diff Detail

Event Timeline

fedor.sergeev created this revision.Tue, Dec 4, 8:46 AM
fedor.sergeev planned changes to this revision.Tue, Dec 4, 9:10 AM

oops, this needs a small update

stack handling fixed (AfterPass now pops stack as well)

minor cleanup

What exactly does this change solve?

fedor.sergeev retitled this revision from [NewPM] -print-module-scope now prints module even after invalidated Loop/SCC to [NewPM] -print-module-scope -print-after now prints module even after invalidated Loop/SCC.Thu, Dec 6, 12:44 PM
fedor.sergeev edited the summary of this revision. (Show Details)

What exactly does this change solve?

updated the summary.

This generally looks fine, some code comments inline.

lib/Passes/StandardInstrumentations.cpp
34

This should be an Optional.

35

Why this intermiate? Why not just return?

169

Avoid AAA

philip.pfaffe added inline comments.Mon, Dec 17, 1:40 PM
lib/Passes/StandardInstrumentations.cpp
35

*intermediate