From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 51977 invoked by alias); 23 Jun 2015 13:23:26 -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 51894 invoked by uid 48); 23 Jun 2015 13:23:22 -0000 From: "evstupac at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/48052] loop not vectorized if index is "unsigned int" Date: Tue, 23 Jun 2015 13:23: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.6.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: evstupac at gmail dot com X-Bugzilla-Status: NEW 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: cc 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: 2015-06/txt/msg02295.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48052 Stupachenko Evgeny changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |evstupac at gmail dot com --- Comment #15 from Stupachenko Evgeny --- The commit caused regressions on some benchmarks. Test to reproduce: (compilations flags: -Ofast) int foo (int flag, char *a) { short i, j; short l = 0; if (flag == 1) l = 3; for (i = 0; i < 4; i++) { for (j = l - 1; j > 0; j--) a[j] = a[j - 1]; a[0] = i; } } Here value of l is between 0 and 3, and therefore value of the innermost loop bound (l - 1) is between -1 and 2. After the commit the innermost loop is replaced with memmove call. This is obviously not optimal as amount of memory to move is not greater than 2.