This fixes fallout from the loops-exist verifier.  And it optimizes
compile-time of IPA pure-const.

Not yet tested in any way (but quite obvious).

Richard.

2013-02-07  Richard Biener  <rguent...@suse.de>

        * Makefile.in (tree-tailcall.o): Add $(CFGLOOP_H) dependency.
        * ipa-pure-const.c (analyze_function): Avoid calling
        mark_irreducible_loops twice.
        * tree-tailcall.c (tree_optimize_tail_calls_1): Mark loops
        for fixup.

Index: gcc/Makefile.in
===================================================================
*** gcc/Makefile.in     (revision 195851)
--- gcc/Makefile.in     (working copy)
*************** tree-tailcall.o : tree-tailcall.c $(TREE
*** 2391,2397 ****
     $(TREE_H) $(TM_P_H) $(FUNCTION_H) $(TM_H) coretypes.h \
     $(EXCEPT_H) $(TREE_PASS_H) $(FLAGS_H) langhooks.h \
     $(BASIC_BLOCK_H) $(DBGCNT_H) $(GIMPLE_PRETTY_PRINT_H) $(TARGET_H) \
!    $(COMMON_TARGET_H)
  tree-ssa-sink.o : tree-ssa-sink.c $(TREE_FLOW_H) $(CONFIG_H) \
     $(SYSTEM_H) $(TREE_H) $(DIAGNOSTIC_H) \
     $(TM_H) coretypes.h $(TREE_PASS_H) $(FLAGS_H) alloc-pool.h \
--- 2391,2397 ----
     $(TREE_H) $(TM_P_H) $(FUNCTION_H) $(TM_H) coretypes.h \
     $(EXCEPT_H) $(TREE_PASS_H) $(FLAGS_H) langhooks.h \
     $(BASIC_BLOCK_H) $(DBGCNT_H) $(GIMPLE_PRETTY_PRINT_H) $(TARGET_H) \
!    $(COMMON_TARGET_H) $(CFGLOOP_H)
  tree-ssa-sink.o : tree-ssa-sink.c $(TREE_FLOW_H) $(CONFIG_H) \
     $(SYSTEM_H) $(TREE_H) $(DIAGNOSTIC_H) \
     $(TM_H) coretypes.h $(TREE_PASS_H) $(FLAGS_H) alloc-pool.h \
Index: gcc/ipa-pure-const.c
===================================================================
*** gcc/ipa-pure-const.c        (revision 195851)
--- gcc/ipa-pure-const.c        (working copy)
*************** end:
*** 779,786 ****
          {
          /* Preheaders are needed for SCEV to work.
             Simple latches and recorded exits improve chances that loop will
!            proved to be finite in testcases such as in loop-15.c and 
loop-24.c  */
!         loop_optimizer_init (LOOPS_NORMAL
                               | LOOPS_HAVE_RECORDED_EXITS);
          if (dump_file && (dump_flags & TDF_DETAILS))
            flow_loops_dump (dump_file, NULL, 0);
--- 779,788 ----
          {
          /* Preheaders are needed for SCEV to work.
             Simple latches and recorded exits improve chances that loop will
!            proved to be finite in testcases such as in loop-15.c
!            and loop-24.c  */
!         loop_optimizer_init (LOOPS_HAVE_PREHEADERS
!                              | LOOPS_HAVE_SIMPLE_LATCHES
                               | LOOPS_HAVE_RECORDED_EXITS);
          if (dump_file && (dump_flags & TDF_DETAILS))
            flow_loops_dump (dump_file, NULL, 0);
*************** end:
*** 799,805 ****
                if (!finite_loop_p (loop))
                  {
                    if (dump_file)
!                     fprintf (dump_file, "    can not prove finiteness of loop 
%i\n", loop->num);
                    l->looping =true;
                    FOR_EACH_LOOP_BREAK (li);
                  }
--- 801,808 ----
                if (!finite_loop_p (loop))
                  {
                    if (dump_file)
!                     fprintf (dump_file, "    can not prove finiteness of "
!                              "loop %i\n", loop->num);
                    l->looping =true;
                    FOR_EACH_LOOP_BREAK (li);
                  }
Index: gcc/tree-tailcall.c
===================================================================
*** gcc/tree-tailcall.c (revision 195851)
--- gcc/tree-tailcall.c (working copy)
*************** along with GCC; see the file COPYING3.
*** 33,38 ****
--- 33,39 ----
  #include "langhooks.h"
  #include "dbgcnt.h"
  #include "target.h"
+ #include "cfgloop.h"
  #include "common/common-target.h"
  
  /* The file implements the tail recursion elimination.  It is also used to
*************** tree_optimize_tail_calls_1 (bool opt_tai
*** 1011,1017 ****
      }
  
    if (changed)
!     free_dominance_info (CDI_DOMINATORS);
  
    /* Add phi nodes for the virtual operands defined in the function to the
       header of the loop created by tail recursion elimination.  Do so
--- 1012,1023 ----
      }
  
    if (changed)
!     {
!       /* We may have created new loops.  Make them magically appear.  */
!       if (current_loops)
!       loops_state_set (LOOPS_NEED_FIXUP);
!       free_dominance_info (CDI_DOMINATORS);
!     }
  
    /* Add phi nodes for the virtual operands defined in the function to the
       header of the loop created by tail recursion elimination.  Do so

Reply via email to