Author: dcoakley
Date: 2010-08-26 19:37:41 -0400 (Thu, 26 Aug 2010)
New Revision: 3322

Modified:
   trunk/osprey/be/lno/forward.cxx
Log:
Avoid doing forward substitution when uses are inline asm inputs.

The exact type of each asm input must be preserved in order to generate
the correct instructions.  Forward substitution may have the side-effect
of promoting the type and therefore needs be skipped in this case.

An earlier attempt to fix the issue was made in trunk commit r2318.
The problem with the previous fix is that it tried to skip the FS in
FS_Substitute(), which is too late.  By then FS_Worthwhile() has
returned TRUE indicating that is possible to do forward substitution
and delete the original store, which FS_Substitute() does
unconditionally.

In the "draw_edges_mmx" test case extracted from ffmpeg (see bug 539),
the combination of the deleted store and skipped substitution resulted
in an asm input that was loaded from uninitialized memory.

Instead, FS_Worthwhile() should return FALSE if any of the uses are
directly under an OPR_ASM_INPUT node.

Approved by: Sun Chan


Modified: trunk/osprey/be/lno/forward.cxx
===================================================================
--- trunk/osprey/be/lno/forward.cxx     2010-08-26 04:50:03 UTC (rev 3321)
+++ trunk/osprey/be/lno/forward.cxx     2010-08-26 23:37:41 UTC (rev 3322)
@@ -1,4 +1,5 @@
 /*
+  Copyright (C) 2010 Advanced Micro Devices, Inc.  All Rights Reserved.
 
   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
 
@@ -229,10 +230,6 @@
     if (FS_Is_Inside_If(use, LWN_Get_Parent(wn_orig)))
       continue; 
 
-    // Bug 539: Don't perform FS for nodes directly under ASM_INPUT
-    if (WN_operator(LWN_Get_Parent(use)) == OPR_ASM_INPUT)
-      continue;
-
     sub_count++; 
     INT position = loop_ls->In(use); 
     INT32 count = 0;
@@ -591,6 +588,11 @@
     }
     if (!Wn_Is_Inside(use, wn_loop))
        return FALSE; 
+
+    // Avoid FS for nodes directly under ASM_INPUT in order to preserve type.
+    if (WN_operator(LWN_Get_Parent(use)) == OPR_ASM_INPUT)
+      return FALSE;
+
     WN* use_loop = Enclosing_Loop(use); 
     if (use_loop != def_loop) {
       all_uses_in_same_def_loop = FALSE;


------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to