From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3FFAA3986649; Mon, 12 Dec 2022 10:56:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3FFAA3986649 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670842578; bh=MlioM1gzZK40zd5b140CZcrGA9vR8wcvWSf6TV7bJgU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=wgghHRTC65wd7zz9v0+908yIN9ySrvibHC7xuwrjLs216VIT/Qo0lWG0lPuySGS+t 1qGo+RXuLlXRkcjSc+B7khHKxgworwRTIC4fhwQThe4Nn1QeWYj3w8SrJ57MU2rAUO eNHUqvGpZDHRyul6x+qCfZALGY4j47+lPoaTV3Gk= 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: Mon, 12 Dec 2022 10:56:15 +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: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: assigned_to bug_status 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 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|rguenth at gcc dot gnu.org |unassigned at gcc d= ot gnu.org Status|ASSIGNED |NEW --- Comment #7 from Richard Biener --- (In reply to Jakub Jelinek from comment #6) > Sure, the FUNCTION_TYPE can be shared, so shouldn't be overwritten in pla= ce, > but can be copied with TREE_READONLY cleared on the copy. > So, if we for whatever reason need to clear const flag on some functions, > after clearing TREE_READONLY on the node->decl we'd also need to update t= he > TREE_TYPE to a version without TREE_READONLY set (so that say if new calls > are created they don't get wrong fntype) and then walk all call edges to > that function, updating gimple_call_fntype to the updated type if it was > equal to the old TREE_TYPE, or to a copy with TREE_READONLY cleared if it > has TREE_READONLY set on the FUNCTION/METHOD_TYPE). That will not catch indirect calls to the function. So whatever we do this part of the problem will remain (the out-of-sync profile). Like inline int __attribute__((const)) foo (int i) { if (i =3D=3D 0) return 2; return 1; } int (* __attribute__((const)) bar) () =3D foo; int main() { int r =3D 0; for (int i =3D 0; i < 10000; ++i) { r +=3D foo (r); r +=3D bar (r); } return r; } which, when compiled with -O2 -fno-early-inlining -fprofile-arcs results in the edge counters from the inline copy via foo to be store-motion'ed but the indirect call clobbering them each iteration. Using -fprofile-use prevents this because we get an indirect call profiler call which clobbers all memory, confusing LIM, doing early inlining will early inline the function before profile instrumentation. I cannot see how we can fix this without some global flag to ignore const/pure-ness of functions or alternatively dropping DECL_NONALIASED. Trying to support surgical un-setting of pure/const for single functions isn't going to work. Simply disabling IPA inlining for instrumented builds might also work.=