From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12421 invoked by alias); 7 May 2013 09:02:53 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 12375 invoked by uid 48); 7 May 2013 09:02:49 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/57186] implement load sinking in loops Date: Tue, 07 May 2013 09:02:00 -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-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Status Last reconfirmed CC Ever Confirmed Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-SW-Source: 2013-05/txt/msg00407.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57186 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2013-05-07 CC| |rguenth at gcc dot gnu.org Ever Confirmed|0 |1 --- Comment #4 from Richard Biener 2013-05-07 09:02:48 UTC --- In theory we have the SCCP patch to address at least case #1. It looks at loop exit PHIs and tries to replace them with the overall effect of the loop (using SCEV analysis, which is why it fails for loads). : # i_15 = PHI _4 = (long unsigned int) i_15; _5 = _4 * 4; _7 = v_6(D) + _5; r_9 = *_7; i_10 = i_15 + 1; if (i_10 != 64) goto ; else goto ; : # r_20 = PHI the complication with handling the above in existing passes (for example code sinking) is that the final value of _7 is needed to sink the dependent computations. So I think what SCCP should do here is look at the single-use chain from the defs of r_20 and analyze the evolution of the dependent loop variant SSA names, performing sinking of the dependencies as well. Conveniently LIM runs before SCCP and performs the necessary store sinking to allow handling of the last case.