public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/46928] New: data dependence analysis fails on constant array accesses
@ 2010-12-13 18:06 spop at gcc dot gnu.org
  2010-12-13 18:09 ` [Bug tree-optimization/46928] " spop at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: spop at gcc dot gnu.org @ 2010-12-13 18:06 UTC (permalink / raw)
  To: gcc-bugs

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++;
    }


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-12-15  5:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-13 18:06 [Bug tree-optimization/46928] New: data dependence analysis fails on constant array accesses spop at gcc dot gnu.org
2010-12-13 18:09 ` [Bug tree-optimization/46928] " spop at gcc dot gnu.org
2010-12-13 18:38 ` xinliangli at gmail dot com
2010-12-13 18:59 ` spop at gcc dot gnu.org
2010-12-13 19:06 ` sebpop at gmail dot com
2010-12-13 19:30 ` spop at gcc dot gnu.org
2010-12-15  5:05 ` spop at gcc dot gnu.org
2010-12-15  5:07 ` spop at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).