[patch] Enable fmove-loop-invariants by default
Zdenek Dvorak
rakdver@atrey.karlin.mff.cuni.cz
Tue Feb 14 23:35:00 GMT 2006
Hello,
> > this patch enables the new loop invariant motion pass by default. This
> > duplicates functionality of loop.c, but I still hope loop.c will be
> > removed soon, and even if not, it is neccessary to have loop-invariant
> > tested if we ever want to use it (I have just spent a week by fixing
> > bugs introduced because it was disabled and nobody tested it).
>
> It may badly interact with -fnon-call-exceptions, causing
>
> FAIL: cxg2007
> FAIL: cxg2012
>
> to pop up in the ACATS testsuite on x86-64/Linux.
>
>
> cxg2007.adb: In function 'CXG2007':
> cxg2007.adb:228: error: missing REG_EH_REGION note in the end of bb 162
> +===========================GNAT BUG DETECTED==============================+
> | 4.2.0 20060213 (experimental) (x86_64-suse-linux-gnu) GCC error: |
> | verify_flow_info failed |
> | Error detected at cxg2007.adb:228:5
>
> (insn 1065 1063 1696 162 (set (mem:XF (plus:DI (reg/f:DI 7 sp)
> (const_int 64 [0x40])) [0 S16 A64])
> (const_double:XF 3.0e+0 [0x0.cp+2])) 99 {*movxf_integer} (nil)
> (expr_list:REG_EH_REGION (const_int 21 [0x15])
> (nil)))
> ;; End of basic block 162, registers live:
> (nil)
>
> Set in insn 1065 is invariant (29), cost 6, depends on
>
> Decided to move invariant 29
>
>
> I'm not sure what the counter-measures were in loop.c against that. Do you
> see any other straightforward solutions than punting in that case?
something like this should help.
Zdenek
Index: loop-invariant.c
===================================================================
*** loop-invariant.c (revision 110963)
--- loop-invariant.c (working copy)
*************** Software Foundation, 51 Franklin Street,
*** 52,57 ****
--- 52,58 ----
#include "flags.h"
#include "df.h"
#include "hashtab.h"
+ #include "except.h"
/* The data stored for the loop. */
*************** find_invariant_insn (rtx insn, bool alwa
*** 761,776 ****
|| !check_maybe_invariant (SET_SRC (set)))
return;
! if (may_trap_p (PATTERN (insn)))
! {
! if (!always_reached)
! return;
! /* Unless the exceptions are handled, the behavior is undefined
! if the trap occurs. */
! if (flag_non_call_exceptions)
! return;
! }
depends_on = BITMAP_ALLOC (NULL);
if (!check_dependencies (insn, depends_on))
--- 762,775 ----
|| !check_maybe_invariant (SET_SRC (set)))
return;
! /* If the insn can throw exception, we cannot move it at all without changing
! cfg. */
! if (can_throw_internal (insn))
! return;
! /* We cannot make trapping insn executed, unless it was executed before. */
! if (may_trap_p (PATTERN (insn)) && !always_reached)
! return;
depends_on = BITMAP_ALLOC (NULL);
if (!check_dependencies (insn, depends_on))
Index: Makefile.in
===================================================================
*** Makefile.in (revision 110964)
--- Makefile.in (working copy)
*************** loop-iv.o : loop-iv.c $(CONFIG_H) $(SYST
*** 2423,2429 ****
loop-invariant.o : loop-invariant.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
$(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(EXPR_H) coretypes.h \
$(TM_H) $(TM_P_H) $(FUNCTION_H) $(FLAGS_H) $(DF_H) $(OBSTACK_H) output.h \
! $(HASHTAB_H)
cfgloopmanip.o : cfgloopmanip.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
$(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(CFGLAYOUT_H) output.h \
coretypes.h $(TM_H) cfghooks.h $(OBSTACK_H)
--- 2423,2429 ----
loop-invariant.o : loop-invariant.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
$(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(EXPR_H) coretypes.h \
$(TM_H) $(TM_P_H) $(FUNCTION_H) $(FLAGS_H) $(DF_H) $(OBSTACK_H) output.h \
! $(HASHTAB_H) except.h
cfgloopmanip.o : cfgloopmanip.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) \
$(BASIC_BLOCK_H) hard-reg-set.h $(CFGLOOP_H) $(CFGLAYOUT_H) output.h \
coretypes.h $(TM_H) cfghooks.h $(OBSTACK_H)
More information about the Gcc-patches
mailing list