This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR42164: ICE in simplify_subreg.


> Since we can calculate the truncated value of a const_int, I add a
> check for this in combine_simplify_rtx(), thus avoiding the troublesome
> code path.
>
> Tested on x86-pc-linux-gnu and currently testing on
> mips64-unknown-linux-gnu, the patch also allow us to once again build
> a working mips64 Linux kernel.
>
> OK to commit if no regressions?

Almost.  CONST_INTs have VOIDmode, use GEN_INT or gen_int_mode instead of 
gen_rtx_CONST_INT to build them.  And the short-circuit should be placed 
after the substitution, not before:

Index: combine.c
===================================================================
--- combine.c   (revision 154864)
+++ combine.c   (working copy)
@@ -5156,6 +5156,10 @@ combine_simplify_rtx (rtx x, enum machin
               force_to_mode (XEXP (x, 0), GET_MODE (XEXP (x, 0)),
                              GET_MODE_MASK (mode), 0));

+      /* We can truncate a constant value and return it.  */
+      if (CONST_INT_P (XEXP (x, 0)))
+       return gen_int_mode (INTVAL (XEXP (x, 0)), mode);

-- 
Eric Botcazou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]