changeset 12683:38f38c10a11d

8164954: split_if creates empty phi and region nodes Summary: Don't split if all edges will be moved to new phi Reviewed-by: kvn, vlivanov
author neliasso
date Mon, 06 Mar 2017 14:08:52 +0100
parents e4f863a6da36
children 6fb85042b428
files src/share/vm/opto/ifnode.cpp
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/opto/ifnode.cpp	Mon Mar 06 21:28:33 2017 +0100
+++ b/src/share/vm/opto/ifnode.cpp	Mon Mar 06 14:08:52 2017 +0100
@@ -249,6 +249,13 @@
       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