Currently, C2 has 3 private constructors of PhaseIdealLoop as follows. a-b are for verification, only c is for real loop optimizations.
a.
// Perform verification that the graph is valid.
PhaseIdealLoop( PhaseIterGVN &igvn)
b.
// Verify that verify_me made the same decisions as a fresh run.
PhaseIdealLoop(PhaseIterGVN &igvn, const PhaseIdealLoop *verify_me)
c.
PhaseIdealLoop(PhaseIterGVN &igvn, LoopOptsMode mode)
I propose 3 changes to simplify them.
1. add assertion in the constructor c. C2 shouldn't use mode = LoopOptsVerify for it.
2. merge a and b into one constructor.
3. make the merged verification ctor only for debug builds.
a.
// Perform verification that the graph is valid.
PhaseIdealLoop( PhaseIterGVN &igvn)
b.
// Verify that verify_me made the same decisions as a fresh run.
PhaseIdealLoop(PhaseIterGVN &igvn, const PhaseIdealLoop *verify_me)
c.
PhaseIdealLoop(PhaseIterGVN &igvn, LoopOptsMode mode)
I propose 3 changes to simplify them.
1. add assertion in the constructor c. C2 shouldn't use mode = LoopOptsVerify for it.
2. merge a and b into one constructor.
3. make the merged verification ctor only for debug builds.