From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 16E4B3858C41; Tue, 16 Jan 2024 07:21:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 16E4B3858C41 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705389688; bh=srEa7/DKossSVQ9jQXpWocfmhWkOsSrKEyPCwuJSPh8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=CUAshA9T9QAL8gbtl0gzKgHj8bAB/YJ6r0AN9xtiqDDT3wBUhD3oEk3BSim7hnqhD TR62maQivdsTXCXNeNQ1dPv2tyiX8VdzqQko4uOZHbe0OMbU/iFtybKrz+2qgdzhuy FCURnPX5z53GwIBrm+8cGEDF23FrzBo/s7FGY+2Y= From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113372] wrong code with _BitInt() arithmetics at -O1 Date: Tue, 16 Jan 2024 07:21:26 +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: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenther at suse dot de X-Bugzilla-Status: NEW 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113372 --- Comment #18 from rguenther at suse dot de --- On Mon, 15 Jan 2024, jakub at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113372 >=20 > --- Comment #17 from Jakub Jelinek --- > (In reply to Richard Biener from comment #15) > > (In reply to Jakub Jelinek from comment #14) > > > Created attachment 57085 [details] > > > gcc14-pr113372.patch > > >=20 > > > The non-propagation workaround which seems to fix^H^H^Hworkaround all= those > > > 4 issues (PR90348 testcase actually doesn't FAIL anymore, but I've ve= rified > > > the patch results in in and buf no longer being shared) can look like= this. > >=20 > > + || (INTEGRAL_TYPE_P (TREE_TYPE (use)) > > + && TYPE_PRECISION (TREE_TYPE (use)) =3D=3D POINTER_SIZE))) > >=20 > > ptrofftype_p (TREE_TYPE (use)) >=20 > Aren't there targets where pointers are larger than sizetype? > I thought msp430, but that one uses __int20. There are also address-spaces with pointer sizes different from POINTER_SIZE. I suppose tracking all INTEGRAL_TYPE_P uses and instead relying on the def to identify a pointer source would work as well. > > I think it should be enough to look at gimple_assing_rhs1, that works > > for single non-invariant &a[i], for conversions and for offsetting of > > an invariant address (pointer-plus). >=20 > Is the invariant operand guaranteed to go first? If it is pointer, guess > POINTER_PLUS_EXPR enforces that, and for sizetype addition guess an opera= nd > can't be ADDR_EXPR, there would need to be a cast in a separate stmt. So > perhaps ok. Yes, I think that works. > As for Micha's fears, I can certainly try to dump statistics during > bootstrap/regtest on how many variables were shared and/or their cumulati= ve > size without/with the patch and see if it has significant effects on real= -world > code. Might be interesting to dump the stack size saved due to sharing instead? Do we really need to handle the PHI nodes btw? With doing propagation we could avoid marking certain use sites as mentions, like compares of the address value. But of course we'd have to give up for uses in calls or other things we can't analyze.=