[LLVMdev] Transforming Loops

Eli Friedman eli.friedman at gmail.com
Tue May 19 00:12:36 PDT 2009


On Tue, May 19, 2009 at 12:04 AM, Marc Brünink <marc at bruenink.de> wrote:
> Hi all,
>
> I need to transform loops like this one
> for (int i = b; i<e; ++i) buffer[i];
>
> into loops like this one:
> for(p=buffer+b; p<buffer+e; ++p) *p;
>
> Does any pass already perform this? If there's none, I guess loop-reduce
> is a good starting point for me, isn't it?

I don't think any pass does this at the moment, but loop-reduce could
easily be extended to do something like that.  Make sure you're using
trunk so you get SCEVs for pointers.

-Eli




More information about the llvm-dev mailing list