Commit 4aded535 by Richard Sandiford Committed by Jeff Law

Remove no-op register to register copies in CSE just like we remove no-op memory to memory copies.

        PR rtl-optimization/90275
        * cse.c (cse_insn): Delete no-op register moves too.

        PR rtl-optimization/90275
        * gcc.c-torture/compile/pr90275.c: New test.
parent daf2852b
2020-03-12 Richard Sandiford <richard.sandiford@arm.com>
PR rtl-optimization/90275
* cse.c (cse_insn): Delete no-op register moves too.
2020-03-12 Darius Galis <darius.galis@cyberthorstudios.com>
* config/rx/rx.md (CTRLREG_CPEN): Remove.
......
......@@ -4625,7 +4625,7 @@ cse_insn (rtx_insn *insn)
for (i = 0; i < n_sets; i++)
{
bool repeat = false;
bool mem_noop_insn = false;
bool noop_insn = false;
rtx src, dest;
rtx src_folded;
struct table_elt *elt = 0, *p;
......@@ -5324,9 +5324,11 @@ cse_insn (rtx_insn *insn)
}
/* Similarly, lots of targets don't allow no-op
(set (mem x) (mem x)) moves. */
(set (mem x) (mem x)) moves. Even (set (reg x) (reg x))
might be impossible for certain registers (like CC registers). */
else if (n_sets == 1
&& MEM_P (trial)
&& !CALL_P (insn)
&& (MEM_P (trial) || REG_P (trial))
&& MEM_P (dest)
&& rtx_equal_p (trial, dest)
&& !side_effects_p (dest)
......@@ -5334,7 +5336,7 @@ cse_insn (rtx_insn *insn)
|| insn_nothrow_p (insn)))
{
SET_SRC (sets[i].rtl) = trial;
mem_noop_insn = true;
noop_insn = true;
break;
}
......@@ -5562,8 +5564,8 @@ cse_insn (rtx_insn *insn)
sets[i].rtl = 0;
}
/* Similarly for no-op MEM moves. */
else if (mem_noop_insn)
/* Similarly for no-op moves. */
else if (noop_insn)
{
if (cfun->can_throw_non_call_exceptions && can_throw_internal (insn))
cse_cfg_altered = true;
......
2020-03-12 Jeff Law <law@redhat.com>
PR rtl-optimization/90275
* gcc.c-torture/compile/pr90275.c: New test.
2020-03-12 Richard Biener <rguenther@suse.de>
PR tree-optimization/94103
......
a, b, c;
long long d;
e() {
char f;
for (;;) {
c = a = c ? 5 : 0;
if (f) {
b = a;
f = d;
}
(d || b) < (a > e) ?: (b ? 0 : f) || (d -= f);
}
}
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