This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR42164: ICE in simplify_subreg.
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: David Daney <ddaney at caviumnetworks dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 2 Dec 2009 21:21:41 +0100
- Subject: Re: [PATCH] Fix PR42164: ICE in simplify_subreg.
- References: <4B16B438.3050609@caviumnetworks.com>
> 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