Author: yug
Date: 2012-02-15 03:38:39 -0500 (Wed, 15 Feb 2012)
New Revision: 3872

Modified:
   trunk/osprey/be/cg/whirl2ops.cxx
Log:
fix for bug948.

Since we allow copy progration into the
ASM_INPUT. More aggressive optimizations could be made.
Now, we could not always assume the "LDID preg_num" for ASM_STMTS output
 appears in
 ...
  LDID preg_num
 STID
 ...
 or
 ...
   LDID preg_num
  CVT(CVTL)
 STID
 ...
forms in the succeeding stmts.
Instead, we now iterate on the store kids to find the "LDID preg_num"
expressions.

Code Review: Lai Jian-Xin.


Modified: trunk/osprey/be/cg/whirl2ops.cxx
===================================================================
--- trunk/osprey/be/cg/whirl2ops.cxx    2012-02-10 07:49:40 UTC (rev 3871)
+++ trunk/osprey/be/cg/whirl2ops.cxx    2012-02-15 08:38:39 UTC (rev 3872)
@@ -114,6 +114,7 @@
 #include "be_symtab.h"
 #include "be_util.h"
 #include "config_asm.h"
+#include "wn_tree_util.h"
 
 #if defined(TARG_X8664) || defined(TARG_NVISA) || defined(TARG_SL) || 
defined(TARG_PPC32)
 #include "cgexp_internals.h"
@@ -6705,20 +6706,40 @@
 #endif
     if (OPERATOR_is_store(WN_operator(stmt))) {
       WN* load = WN_kid0(stmt);
-      OPERATOR opr = WN_operator(load);
-      if (opr == OPR_CVT || opr == OPR_CVTL) {
-        load = WN_kid0(load);
-        opr = WN_operator(load);
-      }
-      if (OPERATOR_is_load(opr) || opr == OPR_LDA) {
-        if (WN_has_sym(load) &&
-            WN_class(load) == CLASS_PREG && 
-            WN_offset(load) == preg_num) {
-          ret_load = load;
-          break;
+      // open64.net bug948. Since we allow copy progration into the 
+      // ASM_INPUT. More aggressive optimizations could be made.
+      // Now, we could not always assume the "LDID preg_num" for ASM_STMTS 
output
+      // appears in 
+      // ...
+      //  LDID preg_num
+      // STID
+      // ...
+      // or 
+      // ...
+      //   LDID preg_num
+      //  CVT(CVTL)
+      // STID
+      // ...
+      // forms in the succeeding stmts.
+      // Instead, we now iterate on the store kid to find the "LDID preg_num"
+      // expressions.
+      WN_TREE_CONTAINER<PRE_ORDER> lpre(load);
+      WN_TREE_CONTAINER<PRE_ORDER> :: iterator lipre;
+      for ( lipre = lpre.begin() ; lipre != lpre.end() ; ++ lipre) {
+        WN* load_expr= lipre.Wn();
+        OPERATOR opr = WN_operator(load_expr);
+        if (OPERATOR_is_load(opr) || opr == OPR_LDA) {
+          if (WN_has_sym(load_expr) &&
+              WN_class(load_expr) == CLASS_PREG && 
+              WN_offset(load_expr) == preg_num) {
+            ret_load = load_expr;
+            break;
+          }
         }
       }
     }
+    if (ret_load)
+      break;
   }
   if (ret_load) {
     if (OPERATOR_has_sym(WN_operator(stmt)) &&


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Open64-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to