This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [GSoC] generation of Gimple code from isl_ast_node_if


> What do you mean by wrong answer? Is there still a bug in the code
> generation or the AST is just more complex as expected.

I mean that the value of res is wrong. I think it is because of the
wrong id of pbb->domain and pbb->transformed inherited from S_3 by S_9
(It was correct for S_3, but it is incorrect for S_9).

> To my understanding bb copies are introduced in case reductions are seen.
> You could try to just initialize an array (maybe a little bit more complex,
> but without += statements):
>
> for i:
>   A[i] = ...
>
> You could do the summation/verfication outside of the scop e.g. in the main
> function.

It seems that it doesn't help (at least for now).

However, I've found out the following example:

static int __attribute__((noinline))
foo ()
{
  int i, res = 0;

  for (i = 0; i < 50; i++)
    {
      if (i < 5)
        res += 1;
    }

  return res;
}

extern void abort ();

int
main (void)
{
  int res = foo ();
  if (res != 5)
    abort ();

  return 0;
}

It gives the correct result, inspite of duplicating of pbbs and
generates the following ISL AST

{
  for (int c1 = 0; c1 <= 49; c1 += 1) {
    for (int c2 = 0; c2 <= 1; c2 += 1)
      S_3(c1);
    if (c1 <= 4)
      S_4(c1);
    S_5(c1);
  }
  S_7();
}

Maybe we could use it. What do you think about this?

--
                                   Cheers, Roman Gareev.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]