[llvm-dev] Loop identification

Catello Cioffi via llvm-dev llvm-dev at lists.llvm.org
Fri Jan 13 07:45:05 PST 2017


Good afternoon,

I'm working on modifying the Mips backend in order to add new
functionalities. I've successfully implemented the intrinsics, but I want
to recognize a pattern like this:

int seq[max];
int cnt = 0;

for (int i = 0; i < max; i++)
{
   for (int j = 0; i < 16; i++)
   {
       char hn = (seq[i] & (3<<(j*2)) >> (j*2);
       if (hn == 2)
          {
             cnt++;
          }
   }
}


and transform it into something like:

int seq[max];
int cnt = 0;

for (int i = 0; i < max; i++)
{
  cnt += intrinsic(seq[i], 2);
}

Do you know what I can use to transform the loop? Or if exists something
similar in LLVM?

Thanks,

Catello
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170113/9970f97b/attachment.html>


More information about the llvm-dev mailing list