From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22743 invoked by alias); 19 Aug 2011 13:37:07 -0000 Received: (qmail 22652 invoked by uid 22791); 19 Aug 2011 13:37:06 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 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; Fri, 19 Aug 2011 13:36:53 +0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/50067] [4.7 Regression] Wrong code with -fpredictive-commoning Date: Fri, 19 Aug 2011 13:46: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: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.7.0 X-Bugzilla-Changed-Fields: 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 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: 2011-08/txt/msg01667.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50067 --- Comment #10 from Richard Guenther 2011-08-19 13:36:49 UTC --- Testcase showing that stripping the offset for the indirect base is bogus: extern int memcmp(const void *, const void *, __SIZE_TYPE__); extern void abort (void); short a[33] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 }; short b[33] = { 0, }; int main() { int i; for (i = 0; i < 64; ++i) { (*((char(*)[])&a[1]))[i] = (*((char(*)[])&a[0]))[i+1]; } if (memcmp (&a, &b, sizeof (a)) != 0) abort (); return 0; } is vectorized because: Creating dr for MEM[(char[] *)&a][i_5] analyze_innermost: success. base_address: &a offset from base address: 0 constant offset from base address: 1 step: 1 aligned to: 128 base_object: MEM[(char[] *)&a] Creating dr for MEM[(char[] *)&a + 2B][i_15] analyze_innermost: success. base_address: &a offset from base address: 0 constant offset from base address: 2 step: 1 aligned to: 128 base_object: MEM[(char[] *)&a] (compute_affine_dependence (stmt_a = D.2739_6 = MEM[(char[] *)&a][i_5]; ) (stmt_b = MEM[(char[] *)&a + 2B][i_15] = D.2739_6; ) (subscript_dependence_tester (analyze_overlapping_iterations (chrec_a = {1, +, 1}_1) (chrec_b = {0, +, 1}_1) (analyze_siv_subscript (analyze_subscript_affine_affine (overlaps_a = [0 + 1 * x_1] ) (overlaps_b = [1 + 1 * x_1] ) ) ) (overlap_iterations_a = [0 + 1 * x_1] ) (overlap_iterations_b = [1 + 1 * x_1] ) ) (analyze_overlapping_iterations (chrec_a = 0B) (chrec_b = 2B) (analyze_ziv_subscript ) (overlap_iterations_a = no dependence ) (overlap_iterations_b = no dependence ) ) (dependence classified: scev_known) ) ) well - that access_fn created for the indirect base is thought to be "independent" on any of the other access_fns: (Data Dep: #(Data Ref: # bb: 3 # stmt: D.2739_20 = MEM[(char[] *)&a][i_19]; # ref: MEM[(char[] *)&a][i_19]; # base_object: MEM[(char[] *)&a]; # Access function 0: {1, +, 1}_2 # Access function 1: 0B #) #(Data Ref: # bb: 3 # stmt: MEM[(char[] *)&a + 2B][i_10] = D.2739_20; # ref: MEM[(char[] *)&a + 2B][i_10]; # base_object: MEM[(char[] *)&a]; # Access function 0: {0, +, 1}_2 # Access function 1: 2B #) (no dependence) that's clearly bogus.