From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 785C63858025; Thu, 14 Oct 2021 18:07:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 785C63858025 From: "stefansf at linux dot ibm.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/102752] [12 Regression] Recent change to ldist causing ICE on msp430-elf, rl78-elf, and xstormy16-elf Date: Thu, 14 Oct 2021 18:07:23 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: stefansf at linux dot ibm.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Oct 2021 18:07:23 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102752 --- Comment #2 from Stefan Schulze Frielinghaus --- It looks like I missed to take the TREE_TYPE of reduction_var. I just did a quick test with diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c index fb9250031b5..0559b9c47d7 100644 --- a/gcc/tree-loop-distribution.c +++ b/gcc/tree-loop-distribution.c @@ -3430,7 +3430,7 @@ generate_strlen_builtin_using_rawmemchr (loop_p loop, tree reduction_var, static bool reduction_var_overflows_first (tree reduction_var, tree load_type) { - widest_int n2 =3D wi::lshift (1, TYPE_PRECISION (reduction_var));; + widest_int n2 =3D wi::lshift (1, TYPE_PRECISION (TREE_TYPE (reduction_va= r)));; widest_int m2 =3D wi::lshift (1, TYPE_PRECISION (ptrdiff_type_node) - 1); widest_int s =3D wi::to_widest (TYPE_SIZE_UNIT (load_type)); return wi::ltu_p (n2, wi::udiv_trunc (m2, s)); @@ -3681,7 +3681,7 @@ loop_distribution::transform_reduction_loop (loop_p l= oop) && ((TYPE_PRECISION (sizetype) >=3D TYPE_PRECISION (ptr_type_node= ) - 1 && TYPE_PRECISION (ptr_type_node) >=3D 32) || (TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (reduction_var)) - && TYPE_PRECISION (reduction_var) <=3D TYPE_PRECISION (sizetype))) + && TYPE_PRECISION (TREE_TYPE (reduction_var)) <=3D TYPE_PRECISION (sizetype))) && builtin_decl_implicit (BUILT_IN_STRLEN)) generate_strlen_builtin (loop, reduction_var, load_iv.base, reduction_iv.base, loc); successfully. It's getting late here. I will come back to this tomorrow morning. Sorry for the inconvenience.=