Author: dcoakley
Date: 2011-07-18 16:10:34 -0400 (Mon, 18 Jul 2011)
New Revision: 3696

Modified:
   trunk/osprey/be/opt/opt_cfg.cxx
   trunk/osprey/be/opt/opt_cfg_trans.cxx
   trunk/osprey/be/opt/opt_main.cxx
   trunk/osprey/common/com/config_opt.cxx
   trunk/osprey/common/com/config_opt.h
Log:
Avoid creating unnecessary region exit blocks.

when control flow optimization is not being done, these BBs are not
needed and can increase memory use signficantly.

The flag OPT_Enable_EH_CFG_OPT controls whether the CFG_transformation
for EH regions is performed.  The default setting is to be enabled only
in mainopt.

Approved by: Mei Ye


Modified: trunk/osprey/be/opt/opt_cfg.cxx
===================================================================
--- trunk/osprey/be/opt/opt_cfg.cxx     2011-07-17 03:36:42 UTC (rev 3695)
+++ trunk/osprey/be/opt/opt_cfg.cxx     2011-07-18 20:10:34 UTC (rev 3696)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2010 Advanced Micro Devices, Inc.  All Rights Reserved.
+ * Copyright (C) 2008-2011 Advanced Micro Devices, Inc.  All Rights Reserved.
  */
 
 /*
@@ -2698,7 +2698,7 @@
   }
 #endif
 
-  if (REGION_is_EH(wn)) 
+  if (OPT_Enable_EH_CFG_OPT && REGION_is_EH(wn)) 
   {
     if (_current_bb->Succ() ||
         _current_bb->Kind() == BB_EXIT)
@@ -3914,7 +3914,8 @@
     opt_tail.Mutate();
   }
 
-  Ident_eh_regions();
+  if (OPT_Enable_EH_CFG_OPT)
+    Ident_eh_regions();
  
   Process_multi_entryexit( TRUE/*is_whirl*/ );
 

Modified: trunk/osprey/be/opt/opt_cfg_trans.cxx
===================================================================
--- trunk/osprey/be/opt/opt_cfg_trans.cxx       2011-07-17 03:36:42 UTC (rev 
3695)
+++ trunk/osprey/be/opt/opt_cfg_trans.cxx       2011-07-18 20:10:34 UTC (rev 
3696)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2010 Advanced Micro Devices, Inc.  All Rights Reserved.
+ * Copyright (C) 2008-2011 Advanced Micro Devices, Inc.  All Rights Reserved.
  */
 
 //-*-c++-*-
@@ -1429,9 +1429,10 @@
                                  insert_iterator<vector<vertex_id> >
                                  (entry, entry.begin()));
 
-  if (ok == CFG_other_regions) {
+  if (ok == CFG_other_regions ||
+      (ok == CFG_EH_regions && !OPT_Enable_EH_CFG_OPT)) {
     if (trace)
-      fprintf(TFile, ("skip CFG transformation because of non-EH REGION."));
+      fprintf(TFile, ("skip CFG transformation."));
     return;
   }
 
@@ -1449,7 +1450,7 @@
   generate_zones(cu, g, zones, do_butterfly, trace, display);
   clone_zones(g, entry, zones.begin(), zones.end(), cfg, trace, display);
 
-  reconstruct_CFG(g, cfg, trace, ok == CFG_EH_regions);
+  reconstruct_CFG(g, cfg, trace, (ok == CFG_EH_regions && 
OPT_Enable_EH_CFG_OPT));
 
   cfg->Invalidate_loops();
   cfg->Analyze_loops();

Modified: trunk/osprey/be/opt/opt_main.cxx
===================================================================
--- trunk/osprey/be/opt/opt_main.cxx    2011-07-17 03:36:42 UTC (rev 3695)
+++ trunk/osprey/be/opt/opt_main.cxx    2011-07-18 20:10:34 UTC (rev 3696)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2010 Advanced Micro Devices, Inc.  All Rights Reserved.
+ * Copyright (C) 2008-2011 Advanced Micro Devices, Inc.  All Rights Reserved.
  */
 
 //-*-c++-*-
@@ -546,6 +546,7 @@
   BOOL _no_return;
   BOOL _nothrow;
   BOOL _simp_if_conv;
+  BOOL _eh_cfg_opt;
 
   WOPT_SWITCHES(const WOPT_SWITCHES&);
   WOPT_SWITCHES& operator = (const WOPT_SWITCHES&);
@@ -672,6 +673,8 @@
           OPT_Enable_WHIRL_SSA)
        WOPT_Enable_Zero_Version = FALSE;
 
+      if (!OPT_Enable_EH_CFG_OPT_Set)
+        OPT_Enable_EH_CFG_OPT = TRUE;
       break; // end MAINOPT_PHASE
 
 #ifdef TARG_NVISA
@@ -819,6 +822,7 @@
       WOPT_Enable_Generate_Trip_Count = _trip;
       WOPT_Enable_LNO_Copy_Propagate  = _lno_copy;
       WOPT_Enable_Zero_Version   = _zero_version;
+      OPT_Enable_EH_CFG_OPT = _eh_cfg_opt;
       break;
 #ifdef TARG_NVISA
     case PREOPT_CMC_PHASE:
@@ -959,6 +963,7 @@
     _no_return = WOPT_Enable_Noreturn_Attr_Opt;
     _nothrow = WOPT_Enable_Nothrow_Opt;
     _simp_if_conv = WOPT_Enable_Simple_If_Conv;
+    _eh_cfg_opt = OPT_Enable_EH_CFG_OPT;
 
     Adjust_Optimization();
   }

Modified: trunk/osprey/common/com/config_opt.cxx
===================================================================
--- trunk/osprey/common/com/config_opt.cxx      2011-07-17 03:36:42 UTC (rev 
3695)
+++ trunk/osprey/common/com/config_opt.cxx      2011-07-18 20:10:34 UTC (rev 
3696)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2010 Advanced Micro Devices, Inc.  All Rights Reserved.
+ * Copyright (C) 2008-2011 Advanced Micro Devices, Inc.  All Rights Reserved.
  */
 
 /*
@@ -347,6 +347,11 @@
 UINT32 AA_force_tag_alias_before_dim1 = 0;
 UINT32 AA_force_tag_alias_before_dim2 = UINT32_MAX;
 
+// enable control flow optimization for the program with EH regions
+// by default it is only enabled in mainopt
+BOOL  OPT_Enable_EH_CFG_OPT = FALSE;
+BOOL  OPT_Enable_EH_CFG_OPT_Set = FALSE;
+
 /***** Obsolete options *****/
 static BOOL Fprop_Limit_Set = FALSE;
 
@@ -913,6 +918,10 @@
     0, 0, UINT32_MAX,  &AA_force_tag_alias_before_dim2, NULL,
     "Triage option for alias analyzer" },
 
+  { OVK_BOOL,   OV_INTERNAL,     TRUE, "eh_cfg_opt",        "",
+    0, 0, 0,    &OPT_Enable_EH_CFG_OPT, &OPT_Enable_EH_CFG_OPT_Set, 
+    "Enable CFO for EH regions"},
+
   /* Obsolete options: */
 
   { OVK_OBSOLETE,      OV_INTERNAL,    FALSE, "global_limit",          NULL,

Modified: trunk/osprey/common/com/config_opt.h
===================================================================
--- trunk/osprey/common/com/config_opt.h        2011-07-17 03:36:42 UTC (rev 
3695)
+++ trunk/osprey/common/com/config_opt.h        2011-07-18 20:10:34 UTC (rev 
3696)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2009 Advanced Micro Devices, Inc.  All Rights Reserved.
+ * Copyright (C) 2008-2011 Advanced Micro Devices, Inc.  All Rights Reserved.
  */
 
 /*
@@ -213,6 +213,8 @@
 extern UINT32 AA_force_tag_alias_before_dim1;
 extern UINT32 AA_force_tag_alias_before_dim2;
 
+extern BOOL OPT_Enable_EH_CFG_OPT;
+extern BOOL OPT_Enable_EH_CFG_OPT_Set;
 #endif
 #ifdef __cplusplus
 }


------------------------------------------------------------------------------
Storage Efficiency Calculator
This modeling tool is based on patent-pending intellectual property that
has been used successfully in hundreds of IBM storage optimization engage-
ments, worldwide.  Store less, Store more with what you own, Move data to 
the right place. Try It Now! http://www.accelacomm.com/jaw/sfnl/114/51427378/
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to