@@ -771,7 +771,7 @@ bool IfNode::cmpi_folds(PhaseIterGVN* igvn, bool fold_ne) {
771771// Is a dominating control suitable for folding with this if?
772772bool IfNode::is_ctrl_folds (Node* ctrl, PhaseIterGVN* igvn) {
773773 return ctrl != nullptr &&
774- ctrl->is_Proj () &&
774+ ctrl->is_IfProj () &&
775775 ctrl->outcnt () == 1 && // No side-effects
776776 ctrl->in (0 ) != nullptr &&
777777 ctrl->in (0 )->Opcode () == Op_If &&
@@ -784,22 +784,23 @@ bool IfNode::is_ctrl_folds(Node* ctrl, PhaseIterGVN* igvn) {
784784}
785785
786786// Do this If and the dominating If share a region?
787- bool IfNode::has_shared_region (ProjNode * proj, ProjNode *& success, ProjNode *& fail) {
788- ProjNode * otherproj = proj->other_if_proj ();
787+ bool IfNode::has_shared_region (IfProjNode * proj, IfProjNode *& success, IfProjNode *& fail) const {
788+ IfProjNode * otherproj = proj->other_if_proj ();
789789 Node* otherproj_ctrl_use = otherproj->unique_ctrl_out_or_null ();
790790 RegionNode* region = (otherproj_ctrl_use != nullptr && otherproj_ctrl_use->is_Region ()) ? otherproj_ctrl_use->as_Region () : nullptr ;
791791 success = nullptr ;
792792 fail = nullptr ;
793793
794794 if (otherproj->outcnt () == 1 && region != nullptr && !region->has_phi ()) {
795795 for (int i = 0 ; i < 2 ; i++) {
796- ProjNode* proj = proj_out (i);
797- if (success == nullptr && proj ->outcnt () == 1 && proj ->unique_out () == region) {
798- success = proj ;
796+ IfProjNode* next_proj = proj_out (i)-> as_IfProj ( );
797+ if (success == nullptr && next_proj ->outcnt () == 1 && next_proj ->unique_out () == region) {
798+ success = next_proj ;
799799 } else if (fail == nullptr ) {
800- fail = proj ;
800+ fail = next_proj ;
801801 } else {
802- success = fail = nullptr ;
802+ success = nullptr ;
803+ fail = nullptr ;
803804 }
804805 }
805806 }
@@ -850,8 +851,8 @@ ProjNode* IfNode::uncommon_trap_proj(CallStaticJavaNode*& call, Deoptimization::
850851}
851852
852853// Do this If and the dominating If both branch out to an uncommon trap
853- bool IfNode::has_only_uncommon_traps (ProjNode * proj, ProjNode *& success, ProjNode *& fail, PhaseIterGVN* igvn) {
854- ProjNode * otherproj = proj->other_if_proj ();
854+ bool IfNode::has_only_uncommon_traps (IfProjNode * proj, IfProjNode *& success, IfProjNode *& fail, PhaseIterGVN* igvn) const {
855+ IfProjNode * otherproj = proj->other_if_proj ();
855856 CallStaticJavaNode* dom_unc = otherproj->is_uncommon_trap_proj ();
856857
857858 if (otherproj->outcnt () == 1 && dom_unc != nullptr ) {
@@ -888,8 +889,8 @@ bool IfNode::has_only_uncommon_traps(ProjNode* proj, ProjNode*& success, ProjNod
888889 !igvn->C ->too_many_traps (dom_method, dom_bci, Deoptimization::Reason_range_check) &&
889890 // Return true if c2 manages to reconcile with UnstableIf optimization. See the comments for it.
890891 igvn->C ->remove_unstable_if_trap (dom_unc, true /* yield*/ )) {
891- success = unc_proj;
892- fail = unc_proj->other_if_proj ();
892+ success = unc_proj-> as_IfProj () ;
893+ fail = unc_proj->as_IfProj ()-> other_if_proj ();
893894 return true ;
894895 }
895896 }
@@ -898,15 +899,15 @@ bool IfNode::has_only_uncommon_traps(ProjNode* proj, ProjNode*& success, ProjNod
898899}
899900
900901// Check that the 2 CmpI can be folded into as single CmpU and proceed with the folding
901- bool IfNode::fold_compares_helper (ProjNode * proj, ProjNode * success, ProjNode * fail, PhaseIterGVN* igvn) {
902+ bool IfNode::fold_compares_helper (IfProjNode * proj, IfProjNode * success, IfProjNode * fail, PhaseIterGVN* igvn) {
902903 Node* this_cmp = in (1 )->in (1 );
903904 BoolNode* this_bool = in (1 )->as_Bool ();
904905 IfNode* dom_iff = proj->in (0 )->as_If ();
905906 BoolNode* dom_bool = dom_iff->in (1 )->as_Bool ();
906907 Node* lo = dom_iff->in (1 )->in (1 )->in (2 );
907908 Node* hi = this_cmp->in (2 );
908909 Node* n = this_cmp->in (1 );
909- ProjNode * otherproj = proj->other_if_proj ();
910+ IfProjNode * otherproj = proj->other_if_proj ();
910911
911912 const TypeInt* lo_type = IfNode::filtered_int_type (igvn, n, otherproj);
912913 const TypeInt* hi_type = IfNode::filtered_int_type (igvn, n, success);
@@ -1108,11 +1109,11 @@ bool IfNode::fold_compares_helper(ProjNode* proj, ProjNode* success, ProjNode* f
11081109// Merge the branches that trap for this If and the dominating If into
11091110// a single region that branches to the uncommon trap for the
11101111// dominating If
1111- Node* IfNode::merge_uncommon_traps (ProjNode * proj, ProjNode * success, ProjNode * fail, PhaseIterGVN* igvn) {
1112+ Node* IfNode::merge_uncommon_traps (IfProjNode * proj, IfProjNode * success, IfProjNode * fail, PhaseIterGVN* igvn) {
11121113 Node* res = this ;
11131114 assert (success->in (0 ) == this , " bad projection" );
11141115
1115- ProjNode * otherproj = proj->other_if_proj ();
1116+ IfProjNode * otherproj = proj->other_if_proj ();
11161117
11171118 CallStaticJavaNode* unc = success->is_uncommon_trap_proj ();
11181119 CallStaticJavaNode* dom_unc = otherproj->is_uncommon_trap_proj ();
@@ -1239,7 +1240,7 @@ void IfNode::improve_address_types(Node* l, Node* r, ProjNode* fail, PhaseIterGV
12391240#endif
12401241}
12411242
1242- bool IfNode::is_cmp_with_loadrange (ProjNode * proj) {
1243+ bool IfNode::is_cmp_with_loadrange (IfProjNode * proj) const {
12431244 if (in (1 ) != nullptr &&
12441245 in (1 )->in (1 ) != nullptr &&
12451246 in (1 )->in (1 )->in (2 ) != nullptr ) {
@@ -1258,7 +1259,7 @@ bool IfNode::is_cmp_with_loadrange(ProjNode* proj) {
12581259 return false ;
12591260}
12601261
1261- bool IfNode::is_null_check (ProjNode * proj, PhaseIterGVN* igvn) {
1262+ bool IfNode::is_null_check (IfProjNode * proj, PhaseIterGVN* igvn) const {
12621263 Node* other = in (1 )->in (1 )->in (2 );
12631264 if (other->in (MemNode::Address) != nullptr &&
12641265 proj->in (0 )->in (1 ) != nullptr &&
@@ -1275,7 +1276,7 @@ bool IfNode::is_null_check(ProjNode* proj, PhaseIterGVN* igvn) {
12751276
12761277// Check that the If that is in between the 2 integer comparisons has
12771278// no side effect
1278- bool IfNode::is_side_effect_free_test (ProjNode * proj, PhaseIterGVN* igvn) {
1279+ bool IfNode::is_side_effect_free_test (IfProjNode * proj, PhaseIterGVN* igvn) const {
12791280 if (proj == nullptr ) {
12801281 return false ;
12811282 }
@@ -1315,9 +1316,9 @@ bool IfNode::is_side_effect_free_test(ProjNode* proj, PhaseIterGVN* igvn) {
13151316// won't be guarded by the first CmpI anymore. It can trap in cases
13161317// where the first CmpI would have prevented it from executing: on a
13171318// trap, we need to restart execution at the state of the first CmpI
1318- void IfNode::reroute_side_effect_free_unc (ProjNode * proj, ProjNode * dom_proj, PhaseIterGVN* igvn) {
1319+ void IfNode::reroute_side_effect_free_unc (IfProjNode * proj, IfProjNode * dom_proj, PhaseIterGVN* igvn) {
13191320 CallStaticJavaNode* dom_unc = dom_proj->is_uncommon_trap_if_pattern ();
1320- ProjNode * otherproj = proj->other_if_proj ();
1321+ IfProjNode * otherproj = proj->other_if_proj ();
13211322 CallStaticJavaNode* unc = proj->is_uncommon_trap_if_pattern ();
13221323 Node* call_proj = dom_unc->unique_ctrl_out ();
13231324 Node* halt = call_proj->unique_ctrl_out ();
@@ -1348,9 +1349,9 @@ Node* IfNode::fold_compares(PhaseIterGVN* igvn) {
13481349 if (is_ctrl_folds (ctrl, igvn)) {
13491350 // A integer comparison immediately dominated by another integer
13501351 // comparison
1351- ProjNode * success = nullptr ;
1352- ProjNode * fail = nullptr ;
1353- ProjNode * dom_cmp = ctrl->as_Proj ();
1352+ IfProjNode * success = nullptr ;
1353+ IfProjNode * fail = nullptr ;
1354+ IfProjNode * dom_cmp = ctrl->as_IfProj ();
13541355 if (has_shared_region (dom_cmp, success, fail) &&
13551356 // Next call modifies graph so must be last
13561357 fold_compares_helper (dom_cmp, success, fail, igvn)) {
@@ -1364,11 +1365,11 @@ Node* IfNode::fold_compares(PhaseIterGVN* igvn) {
13641365 return nullptr ;
13651366 } else if (ctrl->in (0 ) != nullptr &&
13661367 ctrl->in (0 )->in (0 ) != nullptr ) {
1367- ProjNode * success = nullptr ;
1368- ProjNode * fail = nullptr ;
1368+ IfProjNode * success = nullptr ;
1369+ IfProjNode * fail = nullptr ;
13691370 Node* dom = ctrl->in (0 )->in (0 );
1370- ProjNode * dom_cmp = dom->isa_Proj ();
1371- ProjNode * other_cmp = ctrl->isa_Proj ();
1371+ IfProjNode * dom_cmp = dom->isa_IfProj ();
1372+ IfProjNode * other_cmp = ctrl->isa_IfProj ();
13721373
13731374 // Check if it's an integer comparison dominated by another
13741375 // integer comparison with another test in between
0 commit comments