Commit ccb68179 by Richard Sandiford

auto-inc-dec: Don't add incs/decs to bare CLOBBERs [PR93124]

In this PR, auto-inc-dec was trying to turn:

    (set (reg X) (plus (reg X) (const_int N)))
    (clobber (mem (reg X)))

into:

    (clobber (mem (pre_modify (reg X) ...)))

But bare clobber insns are just there to describe dataflow.  They're
not supposed to generate any code.

2020-01-23  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	PR rtl-optimization/93124
	* auto-inc-dec.c (merge_in_block): Don't add auto inc/decs to
	bare USE and CLOBBER insns.

gcc/testsuite/
	* gcc.dg/torture/pr93124.c: New test.
parent 92bea423
2020-01-23 Richard Sandiford <richard.sandiford@arm.com>
PR rtl-optimization/93124
* auto-inc-dec.c (merge_in_block): Don't add auto inc/decs to
bare USE and CLOBBER insns.
2020-01-22 Andrew Pinski <apinski@marvell.com>
* config/arc/arc.c (output_short_suffix): Check insn for nullness.
......
......@@ -1602,9 +1602,15 @@ merge_in_block (int max_reg, basic_block bb)
else
{
insn_is_add_or_inc = false;
mem_insn.insn = insn;
if (find_mem (&PATTERN (insn)))
success_in_block++;
/* We can't use auto inc/dec for bare USEs and CLOBBERs,
since they aren't supposed to generate any code. */
rtx_code code = GET_CODE (PATTERN (insn));
if (code != USE && code != CLOBBER)
{
mem_insn.insn = insn;
if (find_mem (&PATTERN (insn)))
success_in_block++;
}
}
/* If the inc insn was merged with a mem, the inc insn is gone
......
2020-01-23 Richard Sandiford <richard.sandiford@arm.com>
* gcc.dg/torture/pr93124.c: New test.
2020-01-22 David Malcolm <dmalcolm@redhat.com>
PR analyzer/93382
......
/* { dg-additional-options "-fno-rerun-cse-after-loop -fno-guess-branch-probability -fno-tree-fre" } */
int x;
void fn2 ();
void fn3 ();
void fn4 ();
void fn5 ();
void fn6 ();
void
fn1 (void)
{
int n;
for (n = 0;; ++n) {
{
struct { char a[n]; } s;
fn2 (s);
}
struct { unsigned a[x]; } s;
int i, b;
for (i = 0; i < n; ++i)
;
fn2 (s);
{
struct { char a[n]; } s;
int i;
for (i = 0; i < n; ++i)
s.a[i] = i;
fn3 (s, s);
}
fn4 ();
{
struct { unsigned a[n]; } s;
fn5 (s);
}
{
struct { char a[b]; } s;
for (; i < n;)
s.a[i] = i;
fn6 (s);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment