This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR 15825: emit_move_insn problems in ifcvt.c (take 2)
- From: Roger Sayle <roger at eyesopen dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Richard Henderson <rth at redhat dot com>
- Date: Fri, 25 Jun 2004 19:45:03 -0600 (MDT)
- Subject: Re: [PATCH] PR 15825: emit_move_insn problems in ifcvt.c (take 2)
On Fri, 25 Jun 2004, Richard Henderson wrote:
> On Fri, Jun 25, 2004 at 08:49:38AM -0600, Roger Sayle wrote:
> > As a follow-up patch, I'll propose inlining seq_contains_jump
> > directly into end_ifcvt_sequence, it's only remaining caller, to
> > minimize any additional overhead with using this approach.
> > Pre-approval?
>
> Yes, merge the JUMP_INSN check into the existing insn scan loop.
Thanks.
For the record, here's the patch that I've just committed. I only
noticed when deleting the function seq_contains_jump that the function
immediately following it, block_fallthru, didn't have a comment before
it, so I've added one. I also took the liberty of renaming the local
variable "y" to the slightly less cryptic "insn".
The following patch has been tested on i686-pc-linux-gnu with a full
"make bootstrap", all default languages, and regression tested with a
top-level "make -k check" with no new failures.
Committed to mainline CVS.
2004-06-25 Roger Sayle <roger@eyesopen.com>
* ifcvt.c (seq_contains_jump): Delete function.
(end_ifcvt_sequence): Replace call to seq_contains_jump with an
inline test for a jump instruction in the existing "insn" loop.
(block_fallthru): Document function.
Index: ifcvt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ifcvt.c,v
retrieving revision 1.148
diff -c -3 -p -r1.148 ifcvt.c
*** ifcvt.c 25 Jun 2004 18:40:05 -0000 1.148
--- ifcvt.c 25 Jun 2004 21:45:20 -0000
*************** static bool life_data_ok;
*** 88,94 ****
static int count_bb_insns (basic_block);
static rtx first_active_insn (basic_block);
static rtx last_active_insn (basic_block, int);
- static int seq_contains_jump (rtx);
static basic_block block_fallthru (basic_block);
static int cond_exec_process_insns (ce_if_block_t *, rtx, rtx, rtx, rtx, int);
static rtx cond_exec_get_condition (rtx);
--- 88,93 ----
*************** last_active_insn (basic_block bb, int sk
*** 213,234 ****
return insn;
}
! /* It is possible, especially when having dealt with multi-word
! arithmetic, for the expanders to have emitted jumps. Search
! through the sequence and return TRUE if a jump exists so that
! we can abort the conversion. */
!
! static int
! seq_contains_jump (rtx insn)
! {
! while (insn)
! {
! if (GET_CODE (insn) == JUMP_INSN)
! return 1;
! insn = NEXT_INSN (insn);
! }
! return 0;
! }
static basic_block
block_fallthru (basic_block bb)
--- 212,218 ----
return insn;
}
! /* Return the basic block reached by falling though the basic block BB. */
static basic_block
block_fallthru (basic_block bb)
*************** noce_emit_move_insn (rtx x, rtx y)
*** 707,713 ****
static rtx
end_ifcvt_sequence (struct noce_if_info *if_info)
{
! rtx y;
rtx seq = get_insns ();
set_used_flags (if_info->x);
--- 691,697 ----
static rtx
end_ifcvt_sequence (struct noce_if_info *if_info)
{
! rtx insn;
rtx seq = get_insns ();
set_used_flags (if_info->x);
*************** end_ifcvt_sequence (struct noce_if_info
*** 715,729 ****
unshare_all_rtl_in_chain (seq);
end_sequence ();
! if (seq_contains_jump (seq))
! return NULL_RTX;
!
! /* Make sure that all of the instructions emitted are recognizable.
As an excersise for the reader, build a general mechanism that
allows proper placement of required clobbers. */
! for (y = seq; y ; y = NEXT_INSN (y))
! if (recog_memoized (y) == -1)
return NULL_RTX;
return seq;
}
--- 699,713 ----
unshare_all_rtl_in_chain (seq);
end_sequence ();
! /* Make sure that all of the instructions emitted are recognizable,
! and that we haven't introduced a new jump instruction.
As an excersise for the reader, build a general mechanism that
allows proper placement of required clobbers. */
! for (insn = seq; insn; insn = NEXT_INSN (insn))
! if (GET_CODE (insn) == JUMP_INSN
! || recog_memoized (insn) == -1)
return NULL_RTX;
+
return seq;
}
Roger
--