https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78633
--- Comment #2 from Kazumoto Kojima <kkojima at gcc dot gnu.org> ---
Looks not enough. Even with the patch, I got a similar ICE for lto case
in testsuite:
FAIL: gcc.dg/atomic/stdatomic-op-1.c -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects (internal compiler error)
gcc.log says
/exp/ldroot/dodes/ORIG/trunk/gcc/testsuite/gcc.dg/atomic/stdatomic-op-1.c: In
function 'main':
/exp/ldroot/dodes/ORIG/trunk/gcc/testsuite/gcc.dg/atomic/stdatomic-op-1.c:341:1:
error: invalid rtl sharing found in the insn
(insn 1527 292 294 23 (set (reg:SI 147 t)
(eq:SI (subreg:SI (reg:QI 559) 0)
(const_int 0 [0])))
"/exp/ldroot/dodes/ORIG/trunk/gcc/testsuite/gcc.dg/atomic/stdatomic-op-1.c":94
-1
(nil))
/exp/ldroot/dodes/ORIG/trunk/gcc/testsuite/gcc.dg/atomic/stdatomic-op-1.c:341:1:
error: shared rtx
(subreg:SI (reg:QI 559) 0)
/exp/ldroot/dodes/ORIG/trunk/gcc/testsuite/gcc.dg/atomic/stdatomic-op-1.c:341:1:
internal compiler error: internal consistency failure
0x829cca7 verify_rtx_sharing
../../ORIG/trunk/gcc/emit-rtl.c:2743
and it went away with the patch below.
diff --git a/config/sh/sh.md b/config/sh/sh.md
index c6956a0..667a9a5 100644
--- a/config/sh/sh.md
+++ b/config/sh/sh.md
@@ -607,7 +607,7 @@
{
if (dump_file)
fprintf (dump_file, "tstsi_t: converting to cmpeqsi_t\n");
- emit_insn (gen_cmpeqsi_t (eop0.use_as_extended_reg (curr_insn),
+ emit_insn (gen_cmpeqsi_t (copy_rtx(eop0.use_as_extended_reg
(curr_insn)),
const0_rtx));
DONE;
}