8257190: simplify PhaseIdealLoop constructors

Currently, C2 has 3 private constructors of PhaseIdealLoop as follows. a-b are for verification. only c is for real loop optimizations.
a. PhaseIdealLoop( PhaseIterGVN &igvn)
b. 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.

Reviewed-by: thartmann, kvn
This commit is contained in:
Xin Liu 2020-12-01 23:50:53 +00:00 committed by Jie Fu
parent 927504e827
commit ce496cbda5

View File

@ -1045,17 +1045,6 @@ private:
uint *_dom_depth; // Used for fast LCA test
GrowableArray<uint>* _dom_stk; // For recomputation of dom depth
// Perform verification that the graph is valid.
PhaseIdealLoop( PhaseIterGVN &igvn) :
PhaseTransform(Ideal_Loop),
_igvn(igvn),
_verify_me(NULL),
_verify_only(true),
_dom_lca_tags(arena()), // Thread::resource_area
_nodes_required(UINT_MAX) {
build_and_optimize(LoopOptsVerify);
}
// build the loop tree and perform any requested optimizations
void build_and_optimize(LoopOptsMode mode);
@ -1063,26 +1052,30 @@ private:
void Dominators();
// Compute the Ideal Node to Loop mapping
PhaseIdealLoop(PhaseIterGVN &igvn, LoopOptsMode mode) :
PhaseIdealLoop(PhaseIterGVN& igvn, LoopOptsMode mode) :
PhaseTransform(Ideal_Loop),
_igvn(igvn),
_verify_me(NULL),
_verify_me(nullptr),
_verify_only(false),
_dom_lca_tags(arena()), // Thread::resource_area
_nodes_required(UINT_MAX) {
assert(mode != LoopOptsVerify, "wrong constructor to verify IdealLoop");
build_and_optimize(mode);
}
// Verify that verify_me made the same decisions as a fresh run.
PhaseIdealLoop(PhaseIterGVN &igvn, const PhaseIdealLoop *verify_me) :
#ifndef PRODUCT
// Verify that verify_me made the same decisions as a fresh run
// or only verify that the graph is valid if verify_me is null.
PhaseIdealLoop(PhaseIterGVN& igvn, const PhaseIdealLoop* verify_me = nullptr) :
PhaseTransform(Ideal_Loop),
_igvn(igvn),
_verify_me(verify_me),
_verify_only(false),
_verify_only(verify_me == nullptr),
_dom_lca_tags(arena()), // Thread::resource_area
_nodes_required(UINT_MAX) {
build_and_optimize(LoopOptsVerify);
}
#endif
public:
Node* idom_no_update(Node* d) const {