From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13184 invoked by alias); 13 Oct 2010 16:54:56 -0000 Received: (qmail 13169 invoked by uid 22791); 13 Oct 2010 16:54:55 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_FC X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 13 Oct 2010 16:54:42 +0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/46009] New: ?: vectorized, very similar if is not X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Wed, 13 Oct 2010 16:54:00 -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 X-SW-Source: 2010-10/txt/msg01114.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46009 Summary: ?: vectorized, very similar if is not Product: gcc Version: 4.6.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned@gcc.gnu.org ReportedBy: jakub@gcc.gnu.org CC: irar@gcc.gnu.org void bar (int *); void foo (int *a, int *b, int *c, int *d) { int e[1024], i, g; for (i = 0; i < 1024; i++) { g = a[i] + b[i] + c[i] * d[i];; #ifdef WORKS e[i] = g < 10 ? 1 : g; #else if (g < 10) e[i] = 1; else e[i] = g; #endif } bar (e); } is vectorized only if -DWORKS -O3, but not for -O3, although the code is really identical. Not sure if ifcvt should handle this, or instead some earlier pass should detect that both bbs have the same memory destination and change if (g_25 <= 9) goto ; else goto ; : e[i_14] = 1; goto ; : e[i_14] = g_25; : into an unconditional assignment of a PHI result into e[i].