From de10f56d524e6a5c49c8aa6204fbb1adb234af31 Mon Sep 17 00:00:00 2001 From: Nils Eliasson Date: Mon, 6 Mar 2017 14:08:52 +0100 Subject: [PATCH] 8164954: split_if creates empty phi and region nodes Don't split if all edges will be moved to new phi Reviewed-by: kvn, vlivanov --- hotspot/src/share/vm/opto/ifnode.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hotspot/src/share/vm/opto/ifnode.cpp b/hotspot/src/share/vm/opto/ifnode.cpp index 169146a607e..c8ab0bbbd2b 100644 --- a/hotspot/src/share/vm/opto/ifnode.cpp +++ b/hotspot/src/share/vm/opto/ifnode.cpp @@ -249,6 +249,13 @@ static Node* split_if(IfNode *iff, PhaseIterGVN *igvn) { predicate_proj = proj; } } + + // If all the defs of the phi are the same constant, we already have the desired end state. + // Skip the split that would create empty phi and region nodes. + if((r->req() - req_c) == 1) { + return NULL; + } + if (nb_predicate_proj > 1) { // Can happen in case of loop unswitching and when the loop is // optimized out: it's not a loop anymore so we don't care about