re PR target/78614 (ICE error: invalid rtl sharing found in the insn (verify_rtx_shar...
authorJakub Jelinek <jakub@redhat.com>
Fri, 2 Dec 2016 15:42:04 +0000 (16:42 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 2 Dec 2016 15:42:04 +0000 (16:42 +0100)
PR target/78614
* rtl.c (copy_rtx): Don't clear used flag here.
(shallow_copy_rtx_stat): Clear used flag here unless code the rtx
is shareable.
* simplify-rtx.c (simplify_replace_fn_rtx): When copying rtx with
'E' in format, copy all vectors.
* emit-rtl.c (copy_insn_1): Don't clear used flag here.
* valtrack.c (cleanup_auto_inc_dec): Likewise.
* config/rs6000/rs6000.c (rs6000_frame_related): Likewise.

From-SVN: r243194

gcc/ChangeLog
gcc/config/rs6000/rs6000.c
gcc/emit-rtl.c
gcc/rtl.c
gcc/valtrack.c

index 65443a19582f2b1dfeeeee2a591e575b4749fcd3..68d3588715b91c8ec0e26d9344cbd19c1ca8892b 100644 (file)
@@ -1,3 +1,15 @@
+2016-12-02  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/78614
+       * rtl.c (copy_rtx): Don't clear used flag here.
+       (shallow_copy_rtx_stat): Clear used flag here unless code the rtx
+       is shareable.
+       * simplify-rtx.c (simplify_replace_fn_rtx): When copying rtx with
+       'E' in format, copy all vectors.
+       * emit-rtl.c (copy_insn_1): Don't clear used flag here.
+       * valtrack.c (cleanup_auto_inc_dec): Likewise.
+       * config/rs6000/rs6000.c (rs6000_frame_related): Likewise.
+
 2016-12-02  Andre Vieira  <andre.simoesdiasvieira@arm.com>
            Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
index 425a885e75b713187f3c50fae1349978a75fcdef..59bd3fe598912193603ce103aae605e21e427263 100644 (file)
@@ -27186,7 +27186,6 @@ rs6000_frame_related (rtx_insn *insn, rtx reg, HOST_WIDE_INT val,
     {
       pat = shallow_copy_rtx (pat);
       XVEC (pat, 0) = shallow_copy_rtvec (XVEC (pat, 0));
-      RTX_FLAG (pat, used) = 0;
 
       for (int i = 0; i < XVECLEN (pat, 0); i++)
        if (GET_CODE (XVECEXP (pat, 0, i)) == SET)
index d2ac88bd510217d8478df48e01016864ccb4ac66..46505400723b4fdf9c83b320bf189ffd235847b8 100644 (file)
@@ -5552,10 +5552,6 @@ copy_insn_1 (rtx orig)
      us to explicitly document why we are *not* copying a flag.  */
   copy = shallow_copy_rtx (orig);
 
-  /* We do not copy the USED flag, which is used as a mark bit during
-     walks over the RTL.  */
-  RTX_FLAG (copy, used) = 0;
-
   /* We do not copy JUMP, CALL, or FRAME_RELATED for INSNs.  */
   if (INSN_P (orig))
     {
index 3fac1931f3ff8ec869f3c284c5d7ec27d36cae0c..0410f019e5121046b2b541cd316c456af4a989a5 100644 (file)
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -318,10 +318,6 @@ copy_rtx (rtx orig)
      us to explicitly document why we are *not* copying a flag.  */
   copy = shallow_copy_rtx (orig);
 
-  /* We do not copy the USED flag, which is used as a mark bit during
-     walks over the RTL.  */
-  RTX_FLAG (copy, used) = 0;
-
   format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
 
   for (i = 0; i < GET_RTX_LENGTH (GET_CODE (copy)); i++)
@@ -367,7 +363,29 @@ shallow_copy_rtx_stat (const_rtx orig MEM_STAT_DECL)
 {
   const unsigned int size = rtx_size (orig);
   rtx const copy = ggc_alloc_rtx_def_stat (size PASS_MEM_STAT);
-  return (rtx) memcpy (copy, orig, size);
+  memcpy (copy, orig, size);
+  switch (GET_CODE (orig))
+    {
+      /* RTX codes copy_rtx_if_shared_1 considers are shareable,
+        the used flag is often used for other purposes.  */
+    case REG:
+    case DEBUG_EXPR:
+    case VALUE:
+    CASE_CONST_ANY:
+    case SYMBOL_REF:
+    case CODE_LABEL:
+    case PC:
+    case CC0:
+    case RETURN:
+    case SIMPLE_RETURN:
+    case SCRATCH:
+      break;
+    default:
+      /* For all other RTXes clear the used flag on the copy.  */
+      RTX_FLAG (copy, used) = 0;
+      break;
+    }
+  return copy;
 }
 \f
 /* Nonzero when we are generating CONCATs.  */
index 9a1ae2def174e8ab8b04e5e979995e1eaeffbbde..002f49fa6eec9aa5f1b470d9f3ad98eb5ddf340c 100644 (file)
@@ -119,10 +119,6 @@ cleanup_auto_inc_dec (rtx src, machine_mode mem_mode ATTRIBUTE_UNUSED)
      us to explicitly document why we are *not* copying a flag.  */
   x = shallow_copy_rtx (x);
 
-  /* We do not copy the USED flag, which is used as a mark bit during
-     walks over the RTL.  */
-  RTX_FLAG (x, used) = 0;
-
   /* We do not copy FRAME_RELATED for INSNs.  */
   if (INSN_P (x))
     RTX_FLAG (x, frame_related) = 0;