This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix -fcompare-debug issue in cross-jumping (PR rtl-optimization/65980)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 15 Dec 2015 22:13:00 +0100
- Subject: Re: [PATCH] Fix -fcompare-debug issue in cross-jumping (PR rtl-optimization/65980)
- Authentication-results: sourceware.org; auth=none
- References: <20151214201453 dot GG18720 at tucnak dot redhat dot com> <4030571 dot 0BIueKp2sN at polaris>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Dec 15, 2015 at 09:51:15PM +0100, Eric Botcazou wrote:
> > rtx_renumbered_equal_p considers two LABEL_REFs equivalent if they
> > have the same next_real_insn, unfortunately next_real_insn doesn't ignore
> > debug insns. It ignores BARRIERs/JUMP_TABLE_DATA insns too, which is IMHO
> > not desirable either, so this patch uses next_nonnote_nondebug_insn instead
> > (which stops at CODE_LABEL) and keeps iterating if CODE_LABELs are found.
>
> next_active_insn would have done the job, modulo the BARRIER thing, but do we
> really need to care about BARRIER here?
I don't know. For void foo (void) { lab: __builtin_unreachable (); }
we have a BARRIER ending a bb with no control flow insns in there, say with:
void bar (int);
void
foo (int x, int y)
{
if (x == 46)
goto lab1;
if (x == 47)
goto lab2;
if (x > 23)
{
lab1:
if (y) goto lab3;
bar (x);
lab3:
__builtin_unreachable ();
}
bar (5);
lab2:
if (y) goto lab4;
bar (x);
lab4:
__builtin_unreachable ();
}
with -O0 we have in e.g. the *.reload jump:
(code_label 54 79 55 11 10 ("lab4") [1 uses])
(note 55 54 56 11 [bb 11] NOTE_INSN_BASIC_BLOCK)
;; succ:
;; lr out 7 [sp] 16 [argp] 20 [frame]
(barrier 56 55 80)
(note 80 56 0 NOTE_INSN_DELETED)
Now, sure, at -O0 cross-jumping is hopefully not going to be performed,
but I'm worrying about say -O1 -fno-* for a bunch of optimizations that
optimize this at the gimple or RTL level, where cross-jumping could see this.
Jakub