From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E5FB4394740E; Fri, 25 Nov 2022 07:59:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E5FB4394740E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669363193; bh=tgt8uqj2Su3Jb7ftejZLN6Yef+t3d4reK/HgoRFNYO4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bEyxGezD3rHCjcM5CyiocwLWWrStnLU7S3r2YwCakNpyA+WRA0Pfh5jwVnwkS6zo/ BE3OHviLxhDajz1B/w0MKN3Gem7/R/8F7n94zb+A1oXXyHu8XhlzyH6Cwe/j204YyC ilLFG+1FU3CY92aWQHMt39yDOzmXVNT2trvIj0yQ= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/106912] [13 Regression] ICE in vect_transform_loops, at tree-vectorizer.cc:1032 since r13-1575-gcf3a120084e94614 Date: Fri, 25 Nov 2022 07:59:51 +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: 13.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106912 --- Comment #5 from Richard Biener --- (In reply to Richard Biener from comment #3) > OK, it's a late IPA pass doing the clones it seems. The scalar node got = the > 'const' stripped btw, but the call fntype still has it via the attributes. >=20 > It loses 'const' by >=20 > Old value =3D 252968993 > New value =3D 251920417 > set_const_flag_1 (node=3D, > set_const=3Dfalse, looping=3Dfalse, changed=3D0x7fffffffda5f) at > /home/rguenther/src/trunk/gcc/cgraph.cc:2696 > 2696 DECL_LOOPING_CONST_OR_PURE_P (node->decl) =3D false; > (gdb) bt > #0 set_const_flag_1 (node=3D,=20 > set_const=3Dfalse, looping=3Dfalse, changed=3D0x7fffffffda5f) > at /home/rguenther/src/trunk/gcc/cgraph.cc:2696 > #1 0x0000000000da633f in cgraph_node::set_const_flag ( > this=3D, set_const=3Dfals= e,=20 > looping=3Dfalse) at /home/rguenther/src/trunk/gcc/cgraph.cc:2789 > #2 0x00000000015e2910 in tree_profiling () > at /home/rguenther/src/trunk/gcc/tree-profile.cc:818 > #3 0x00000000015e2b9f in (anonymous > namespace)::pass_ipa_tree_profile::execute > (this=3D0x42a0c70) at /home/rguenther/src/trunk/gcc/tree-profile.cc:8= 88 >=20 > but the IL happily continues to treat the calls as 'const' because > flags_from_decl_or_type on the call fntype has >=20 > 849 else if (TYPE_P (exp)) > 850 { > 851 if (TYPE_READONLY (exp)) > 852 flags |=3D ECF_CONST; >=20 > note that __attribute__((pure)) is not duplicated on the type and so the > IPA profile effect will change the IL in fixup_cfg (), rewriting virtual > operands there. > making things consistent. Just to note, since types are shared we cannot simply strip the attribute from the function decls type. If the instead unshare it and do the type change local to the decl the calls to the function won't pick up this chang= e. So the only way out here is to never go const -> non-const (or pure -> non-pure) because that cannot work reliably (consider indirect calls for example).=