From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24897 invoked by alias); 13 Dec 2010 18:06:53 -0000 Received: (qmail 24889 invoked by uid 22791); 13 Dec 2010 18:06:52 -0000 X-SWARE-Spam-Status: No, hits=-2.8 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; Mon, 13 Dec 2010 18:06:48 +0000 From: "spop at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/46928] New: data dependence analysis fails on constant array accesses 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: X-Bugzilla-Severity: normal X-Bugzilla-Who: spop 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: Mon, 13 Dec 2010 18:06: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-12/txt/msg01456.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46928 Summary: data dependence analysis fails on constant array accesses Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned@gcc.gnu.org ReportedBy: spop@gcc.gnu.org In this code we should be able to convert the inner loop to memset zero with ./cc1 -O3 bug.c typedef int mad_fixed_t; struct mad_pcm { unsigned int samplerate; unsigned short channels; unsigned short length; mad_fixed_t samples[2][1152]; }; struct mad_synth { mad_fixed_t filter[2][2][2][16][8]; unsigned int phase; struct mad_pcm pcm; }; void mad_synth_mute (struct mad_synth *synth); void mad_synth_mute (struct mad_synth *synth) { unsigned int ch; unsigned int s; unsigned int v; ch = 0U; while (ch < 2U) { s = 0U; while (s < 16U) { v = 0U; while (v < 8U) { synth->filter[ch][1][1][s][v] = 0; synth->filter[ch][1][0][s][v] = 0; synth->filter[ch][0][1][s][v] = 0; synth->filter[ch][0][0][s][v] = 0; v++; } s++; } ch++; } return; } When looking at the output of the dump ./cc1 -O3 -fdump-tree-ldist-details bug.c the data dependence analysis fails to analyze the overlapping iterations for s_29: (compute_affine_dependence (stmt_a = synth_7(D)->filter[ch_28][0][1][s_29][v_30] = 0; ) (stmt_b = synth_7(D)->filter[ch_28][0][0][s_29][v_30] = 0; ) (subscript_dependence_tester (analyze_overlapping_iterations (chrec_a = {0, +, 1}_3) (chrec_b = {0, +, 1}_3) (overlap_iterations_a = [0] ) (overlap_iterations_b = [0] ) ) (analyze_overlapping_iterations (chrec_a = s_29) (chrec_b = s_29) (overlap_iterations_a = not known ) (overlap_iterations_b = not known ) ) (dependence classified: scev_not_known) ) ) When we remove the s loop, we transform the following code with memset zero: ch = 0U; while (ch < 2U) { v = 0U; while (v < 8U) { synth->filter[ch][1][1][0][v] = 0; synth->filter[ch][1][0][0][v] = 0; synth->filter[ch][0][1][0][v] = 0; synth->filter[ch][0][0][0][v] = 0; v++; } ch++; }