The following patch limit the depth for post-dom walk in the analysis
-- in the presence of complicated control flow, the analysis should
bail out sooner.

Bootstrapped on x86-64/linux. No regressions found.  OK for trunk?

thanks,

David



2013-03-01  Xinliang David Li  <davi...@google.com>

* tree-ssa-uninit.c (compute_control_dep_chain): Limit post-dom
walk length.


 #define MAX_NUM_CHAINS 8
 #define MAX_CHAIN_LEN 5
+#define MAX_POSTDOM_CHECK 8

 /* Computes the control dependence chains (paths of edges)
    for DEP_BB up to the dominating basic block BB (the head node of a
@@ -269,6 +270,7 @@ compute_control_dep_chain (basic_block b
   FOR_EACH_EDGE (e, ei, bb->succs)
     {
       basic_block cd_bb;
+      int post_dom_check = 0;
       if (e->flags & (EDGE_FAKE | EDGE_ABNORMAL))
         continue;

@@ -298,7 +300,8 @@ compute_control_dep_chain (basic_block b
             }

           cd_bb = find_pdom (cd_bb);
-          if (cd_bb == EXIT_BLOCK_PTR)
+          post_dom_check++;
+          if (cd_bb == EXIT_BLOCK_PTR || post_dom_check > MAX_POSTDOM_CHECK)
             break;
         }
       cur_cd_chain->pop ();

Reply via email to