From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 739B03858C60; Fri, 7 Jul 2023 06:49:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 739B03858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688712560; bh=8bZlB84IZd6Oa18ggIxNq8COSS4zXcBl52NBuDCC9MA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=UjD8NBqGWEpwJWiZQKjNU8o5jdVheNnADlhDevvV2iBvmDL87kTwUKzDFPA6my56r QBBEfeTKkE5FRQ1qvCE6B0BcmUH54tviJoI0w2oukZKf4YstqvN/jk40oFNgy8f3FZ RsO90SPxC745BiQbNFqX0J9aMIKln1UdZ2XrPjew= From: "olegendo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/55190] ivopts causes loop setup bloat Date: Fri, 07 Jul 2023 06:49:19 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 4.8.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: olegendo at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: amker 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=3D55190 --- Comment #12 from Oleg Endo --- (In reply to Oleg Endo from comment #0) > The following code: >=20 > struct X > { > int a, b, c, d, e; > }; >=20 > int test (X* x, unsigned int c) > { > int s =3D 0; > unsigned int i; > for (i =3D 0; i < c; ++i) > s +=3D x[i].b; > return s; > } >=20 > results in: > tst r5,r5 > bt/s .L4 > mov r5,r1 > shll2 r1 > add r5,r1 > mov.l .L9,r2 > shll2 r1 > add #-20,r1 > shlr2 r1 > mul.l r2,r1 > mov.l .L10,r2 > add #4,r4 > mov #0,r0 > sts macl,r1 > and r2,r1 > add #1,r1 > .L3: > mov.l @r4,r2 > dt r1 > add #20,r4 > bf/s .L3 > add r2,r0 > rts > nop > .L4: > rts > mov #0,r0 > .L11: > .align 2 > .L9: > .long 214748365 > .L10: > .long 1073741823 >=20 As of GCC 13, this still produces the same code with loop header bloat.=