Author: shivaram
Date: 2011-09-08 01:45:14 -0400 (Thu, 08 Sep 2011)
New Revision: 3732
Modified:
trunk/osprey/be/cg/x8664/ebo_special.cxx
Log:
Fixed a problem in load folding optimization where the memory location used
in the load operation is overwritten by a store operation. A check is added
to prevent folding of such load operations.
CR by Jian-Xin
Modified: trunk/osprey/be/cg/x8664/ebo_special.cxx
===================================================================
--- trunk/osprey/be/cg/x8664/ebo_special.cxx 2011-09-06 08:57:48 UTC (rev
3731)
+++ trunk/osprey/be/cg/x8664/ebo_special.cxx 2011-09-08 05:45:14 UTC (rev
3732)
@@ -10983,7 +10983,42 @@
return FALSE;
if (index_loc >= 0 && !Pred_Opnd_Avail(op, loaded_tn_info, index_loc))
return FALSE;
+ // for this bb, obtain the dependence graph so that we can
+ // walk this op's expression tree to check dependencies.
+ // Make sure that load operand is not overwritten
+ // by a store operation before op using this dependency graph.
+ CG_DEP_Compute_Graph ( op->bb,
+ NO_ASSIGNED_REG_DEPS,
+ NON_CYCLIC,
+ NO_MEMREAD_ARCS,
+ INCLUDE_MEMIN_ARCS,
+ NO_CONTROL_ARCS,
+ NULL);
+
+
+ const INT hash_value = EBO_hash_op( load, NULL );
+ EBO_OP_INFO* opinfo = EBO_opinfo_table[hash_value];
+
+ while( opinfo != NULL ) {
+ OP* next_op = opinfo->in_op;
+ if( next_op == load ) break;
+ if( next_op && OP_store( next_op ) ) {
+ ARC_LIST *arcs;
+ for (arcs = OP_succs(load); arcs != NULL; arcs = ARC_LIST_rest(arcs)) {
+ ARC *arc = ARC_LIST_first(arcs);
+ if (ARC_kind(arc) != CG_DEP_MEMANTI) continue;
+ OP *succ_op = ARC_succ(arc);
+ if ((succ_op == next_op) && OP_Precedes(next_op, op)) {
+ CG_DEP_Delete_Graph (op->bb);
+ return FALSE;
+ }
+ }
+ }
+ opinfo = opinfo->same;
+ }
+ CG_DEP_Delete_Graph (op->bb);
+
TOP topcode;
if (base && offset && index && scale) {
new_op = Mk_OP (TOP_fmovddupxx,
------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops? How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
_______________________________________________
Open64-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/open64-devel