Fix 92085-2.c ICE due to having (const_int 0) as the destination of a set.
authorJeff Law <law@torsion.usersys.redhat.com>
Mon, 1 Jun 2020 21:14:50 +0000 (17:14 -0400)
committerJeff Law <law@torsion.usersys.redhat.com>
Mon, 1 Jun 2020 21:18:03 +0000 (17:18 -0400)
gcc/
* lower-subreg.c (resolve_simple_move): If simplify_gen_subreg_concatn
returns (const_int 0) for the destination, then emit nothing.

gcc/lower-subreg.c

index a11e535b5bfb2006e12f46a2d4b655f6fe06e093..abe7180c686f9de5a2b2d8e57c3568c0a4daa192 100644 (file)
@@ -1087,12 +1087,21 @@ resolve_simple_move (rtx set, rtx_insn *insn)
        emit_clobber (dest);
 
       for (i = 0; i < words; ++i)
-       emit_move_insn (simplify_gen_subreg_concatn (word_mode, dest,
-                                                    dest_mode,
-                                                    i * UNITS_PER_WORD),
-                       simplify_gen_subreg_concatn (word_mode, src,
-                                                    orig_mode,
-                                                    i * UNITS_PER_WORD));
+       {
+         rtx t = simplify_gen_subreg_concatn (word_mode, dest,
+                                              dest_mode,
+                                              i * UNITS_PER_WORD);
+         /* simplify_gen_subreg_concatn can return (const_int 0) for
+            some sub-objects of paradoxical subregs.  As a source operand,
+            that's fine.  As a destination it must be avoided.  Those are
+            supposed to be don't care bits, so we can just drop that store
+            on the floor.  */
+         if (t != CONST0_RTX (word_mode))
+           emit_move_insn (t,
+                           simplify_gen_subreg_concatn (word_mode, src,
+                                                        orig_mode,
+                                                        i * UNITS_PER_WORD));
+       }
     }
 
   if (real_dest != NULL_RTX)