From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 14F1D3856DCA; Tue, 16 May 2023 23:22:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 14F1D3856DCA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684279335; bh=+v2myXOpTX6S20OZbkDqtmMZTviS9WrICdKBuUxqJoA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=l7JtkDQ8oFfEG8i/1c//95KA+GN+QyvFtMY9oNrbXj0ByUGB+Y2h++edT5w2tSEwc S4LmDkXlw8q6qFga4w3dhMqJ+w3XSa4Ox0qKzsJqb1Psm4QMKJh4tiqQ37zuoRLHTQ 4K11en+rLslDmi10bkbsrqlvaqaGLWxpWGqzXPpY= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/68086] Expression explicitly defined outside the loop is moved inside the loop by the optimizer Date: Tue, 16 May 2023 23:22:14 +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: 5.2.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: component 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=3D68086 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Component|rtl-optimization |tree-optimization --- Comment #3 from Andrew Pinski --- So we start with: : _1 =3D (long unsigned int) i_13; _2 =3D _1 * 4; _3 =3D -_2; rebased_15 =3D data_14(D) + _3; goto ; [INV] : _4 =3D (long unsigned int) i_10; _5 =3D _4 * 4; _6 =3D rebased_15 + _5; _7 =3D *_6; And then forwprop turns it into: _4 =3D (long unsigned intD.16) i_10; _5 =3D _4 * 4; _11 =3D _4 - _1; _21 =3D _11 * 4; _6 =3D data_14(D) + _21; # VUSE <.MEM_16(D)> _7 =3D *_6; Except then IVOPT does not know how to handle this correctly.=