[LLVMdev] Replacing a repetitive sequence of code with a loop

Renato Golin renato.golin at linaro.org
Wed Jun 3 15:47:44 PDT 2015


On 3 Jun 2015 11:26 pm, "Frank Winter" <fwinter at jlab.org> wrote:
>
> Ok, I will do some code reading;the reroll pass seems seems a good
starting point.

Philip is right that we should try to do this in a generic way, but we
don't want to pass it on everything. If you can annotate the IR, maybe we
could start with some metadata, and use pragmas later.

> All functions are generated at runtime with the builder (I am not coming
from a higher level language). Thus, I could embed the whole function in a
loop with one iteration. I will probably try this, just to see what the
reroll pass thinks about it.It will not solve everything. In real world
code the code junks can become quite large (over 1000 instructions) and I
doubt that the reroller can handle that in it's current state.

Probably not, but I can't see it being too hard to do it and still have the
old behaviour.

> There's onemore thing.The resulting loops will have high iteration counts
so that it would make sense to use all available CPU cores and distribute
the iterations among them. As far as I can see it, threading must be taken
care of 'outside of the LLVM IR', right?

Not necessarily. You can use OpenMP.

Clang supports a lot of MP pragmas and there's also a run time library. If
you don't use clang, you might have to tweak a bit, though.

Cheers,
Renato
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150603/b2f3dcdd/attachment.html>


More information about the llvm-dev mailing list