From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id ACBAA394504F; Fri, 12 Feb 2021 08:27:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ACBAA394504F From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/99078] [8/9/10/11 Regression] Optimizer moves struct initialization into loop Date: Fri, 12 Feb 2021 08:27:31 +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: 10.2.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 8.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cf_reconfirmed_on cf_known_to_work short_desc everconfirmed component keywords cf_known_to_fail bug_status priority cc target_milestone 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: Fri, 12 Feb 2021 08:27:31 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99078 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2021-02-12 Known to work| |6.5.0 Summary|Optimizer moves struct |[8/9/10/11 Regression] |initialization into loop |Optimizer moves struct | |initialization into loop Ever confirmed|0 |1 Component|c++ |tree-optimization Keywords| |missed-optimization Known to fail| |11.0, 7.5.0 Status|UNCONFIRMED |NEW Priority|P3 |P2 CC| |jamborm at gcc dot gnu.org, | |rguenth at gcc dot gnu.org Target Milestone|--- |8.5 --- Comment #1 from Richard Biener --- Confirmed. It is SRA that with total scalarization re-materializes 's' bef= ore the aggregate use it cannot transform (*dest_106 =3D s). Looks like quite pointless in any case (removing one set of inits just to re-emit them for the single remat case), maybe there's no costing involved at all? There isn't really sth like a pass that hoists stores so undoing this is really hard which means better avoid total scalarization of sth where rematerialization in a bigger loop depth is required? --- t.C.117t.cplxlower1 2021-02-12 09:17:00.278704232 +0100 +++ t.C.118t.sra 2021-02-12 09:17:00.278704232 +0100 ... @@ -10,26 +58,46 @@ [local count: 118111600]: s =3D {}; - s.c[1] =3D 1; - s.c[2] =3D 2; - s.c[3] =3D 3; - s.c[4] =3D 4; - s.c[5] =3D 5; - s.c[6] =3D 6; - s.c[8] =3D 8; - s.c[9] =3D 9; - s.c[10] =3D 10; - s.c[11] =3D 11; - s.c[12] =3D 12; - s.c[13] =3D 13; - s.c[14] =3D 14; - s.c[16] =3D 16; - s.c[17] =3D 17; - s.c[18] =3D 18; - s.c[19] =3D 19; - s.c[20] =3D 20; - s.c[21] =3D 21; - s.c[22] =3D 22; + s$c$1_12 =3D 0; + s$c$2_5 =3D 0; + s$c$3_4 =3D 0; + s$c$4_101 =3D 0; + s$c$5_100 =3D 0; + s$c$6_99 =3D 0; + s$c$8_116 =3D 0; + s$c$9_119 =3D 0; + s$c$10_121 =3D 0; + s$c$11_124 =3D 0; + s$c$12_126 =3D 0; + s$c$13_129 =3D 0; + s$c$14_131 =3D 0; + s$c$16_64 =3D 0; + s$c$17_66 =3D 0; + s$c$18_69 =3D 0; + s$c$19_71 =3D 0; + s$c$20_74 =3D 0; + s$c$21_76 =3D 0; + s$c$22_79 =3D 0; + s$c$1_81 =3D 1; + s$c$2_84 =3D 2; + s$c$3_86 =3D 3; + s$c$4_89 =3D 4; + s$c$5_91 =3D 5; + s$c$6_94 =3D 6; + s$c$8_96 =3D 8; + s$c$9_29 =3D 9; + s$c$10_31 =3D 10; + s$c$11_34 =3D 11; + s$c$12_36 =3D 12; + s$c$13_39 =3D 13; + s$c$14_41 =3D 14; + s$c$16_44 =3D 16; + s$c$17_46 =3D 17; + s$c$18_49 =3D 18; + s$c$19_51 =3D 19; + s$c$20_54 =3D 20; + s$c$21_56 =3D 21; + s$c$22_59 =3D 22; count_104 =3D count_20(D) + 4294967295; if (count_20(D) !=3D 0) goto ; [89.00%] @@ -40,6 +108,26 @@ # dest_106 =3D PHI # count_114 =3D PHI dest_25 =3D dest_106 + 24; + s.c[1] =3D s$c$1_81; + s.c[2] =3D s$c$2_84; + s.c[3] =3D s$c$3_86; + s.c[4] =3D s$c$4_89; + s.c[5] =3D s$c$5_91; + s.c[6] =3D s$c$6_94; + s.c[8] =3D s$c$8_96; + s.c[9] =3D s$c$9_29; + s.c[10] =3D s$c$10_31; + s.c[11] =3D s$c$11_34; + s.c[12] =3D s$c$12_36; + s.c[13] =3D s$c$13_39; + s.c[14] =3D s$c$14_41; + s.c[16] =3D s$c$16_44; + s.c[17] =3D s$c$17_46; + s.c[18] =3D s$c$18_49; + s.c[19] =3D s$c$19_51; + s.c[20] =3D s$c$20_54; + s.c[21] =3D s$c$21_56; + s.c[22] =3D s$c$22_59; *dest_106 =3D s; count_23 =3D count_114 + 4294967295; if (count_114 !=3D 0)=