changeset 99:8a4ef4e001d3

6680594: Load + Load isn't canonicalized leading to missed GVN opportunities Reviewed-by: kvn, jrose
author never
date Fri, 28 Mar 2008 09:00:39 -0700
parents deb97b8ef02b
children c7c777385a15
files src/share/vm/opto/addnode.cpp
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/opto/addnode.cpp	Wed Mar 26 12:25:06 2008 -0700
+++ b/src/share/vm/opto/addnode.cpp	Fri Mar 28 09:00:39 2008 -0700
@@ -70,9 +70,14 @@
 
   // Convert "Load+x" into "x+Load".
   // Now check for loads
-  if( in2->is_Load() ) return false;
-  // Left is a Load and Right is not; move it right.
-  if( in1->is_Load() ) {
+  if (in2->is_Load()) {
+    if (!in1->is_Load()) {
+      // already x+Load to return
+      return false;
+    }
+    // both are loads, so fall through to sort inputs by idx
+  } else if( in1->is_Load() ) {
+    // Left is a Load and Right is not; move it right.
     add->swap_edges(1, 2);
     return true;
   }