From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1077 invoked by alias); 12 Jun 2014 21:22:55 -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 1047 invoked by uid 48); 12 Jun 2014 21:22:52 -0000 From: "cas43 at cs dot stanford.edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/61481] Poor optimization of simple small-sized matrix routines with constant data Date: Thu, 12 Jun 2014 21:22: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-Version: 4.10.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: cas43 at cs dot stanford.edu X-Bugzilla-Status: NEW 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: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-06/txt/msg01143.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61481 --- Comment #3 from Craig Schroeder --- Created attachment 32930 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32930&action=edit More practical (but more complex) example I am trying to optimize an auto-differentiation utility. The example above was the result of simplifying a very complex program down to a simple one that exhibits many of the same problems. Auto-differentiation frequently produces calculations that are trivial or unused, but shaving those computations out in the code would be quite difficult. Attached is portion of an application of it, stripped down to the routines that are actually used and with some unneeded templatization removed. As in the simpler example, the relative order of loop unrolling and sccp seems to be the source of problem. After flattening, there are three loops, with no nested loops. None are unrolled during prog.cpp.058t.cunrolli. All three are unrolled during prog.cpp.118t.cunroll, but that is too late for the prog.cpp.103t.sccp step.