Author: minz
Date: 2011-02-04 14:02:19 -0500 (Fri, 04 Feb 2011)
New Revision: 3472

Modified:
   trunk/osprey/be/opt/opt_loop.cxx
Log:
Fix for bug 717:

Reset ISOP_INVARIANT_VISITED for the CK_IVAR (and its children) if 
CK_IVAR is loop variant, since CK_OP can be a child of a CR_IVAR.  
Not resetting ISOP_INVARIANT_VISITED will make CK_OP be treated as loop 
invariant for another loop, in which CK_OP is loop variant.

Code Review: Sun Chan




Modified: trunk/osprey/be/opt/opt_loop.cxx
===================================================================
--- trunk/osprey/be/opt/opt_loop.cxx    2011-02-01 08:01:30 UTC (rev 3471)
+++ trunk/osprey/be/opt/opt_loop.cxx    2011-02-04 19:02:19 UTC (rev 3472)
@@ -564,26 +564,27 @@
 
   case CK_IVAR:
     {
-      CODEREP *base =
-       cr->Istr_base() ? cr->Istr_base() : cr->Ilod_base();
-      if ( ! Invariant_cr_rec(base) )
-       return FALSE;
-      if ( cr->Opr() == OPR_MLOAD && ! Invariant_cr_rec( cr->Mload_size() ) )
-       return FALSE;
-      if ( cr->Opr() == OPR_ILOADX && ! Invariant_cr_rec( cr->Index() ) )
-       return FALSE;
+      CODEREP *base = cr->Istr_base() ? cr->Istr_base() : cr->Ilod_base();
+
+      // volatile references are never loop invariant
+      if (cr->Is_ivar_volatile() ||
+         !Invariant_cr_rec(base) ||
+        (cr->Opr() == OPR_MLOAD && ! Invariant_cr_rec( cr->Mload_size())) ||
+        (cr->Opr() == OPR_ILOADX && ! Invariant_cr_rec( cr->Index()))) {
+        if ( WOPT_Enable_Prune ) 
+            cr->Reset_isop_visited( ISOP_INVARIANT_VISITED );
+        return FALSE;
+      }
       MU_NODE *mnode = cr->Ivar_mu_node();
       if ( mnode ) {
-       CODEREP *opnd = mnode->OPND();
-       if ( opnd && ! Invariant_cr_rec( opnd ) )
-         return FALSE;
+           CODEREP *opnd = mnode->OPND();
+           if ( opnd && ! Invariant_cr_rec( opnd ) ) {
+            if ( WOPT_Enable_Prune )
+                cr->Reset_isop_visited( ISOP_INVARIANT_VISITED );
+               return FALSE;
+        }  
       }
-    }
 
-    // volatile references are never loop invariant
-    if ( cr->Is_ivar_volatile() ) 
-      return FALSE;
-
     // no need to check Ivar_defstmt.  It is NULL unless
     // there is a ISTORE of the base address.
     // 
@@ -593,7 +594,7 @@
     // return ( ! True_body_set()->MemberP( cr->Ivar_defstmt()->Bb() ) );
 
     return TRUE;
-
+  }  
   case CK_OP:
     {
       if ( cr->Is_isop_flag_set( ISOP_INVARIANT_VISITED )


------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world? 
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to