[LLVMdev] Replacing a repetitive sequence of code with a loop
Renato Golin
renato.golin at linaro.org
Wed Jun 3 13:13:00 PDT 2015
On 3 June 2015 at 19:57, Benjamin Kramer <benny.kra at gmail.com> wrote:
> There's a loop reroll pass in LLVM trunk that should do exactly this transformation.
Though that's a loop pass (runOnLoop). What you could do is add a
previous pass that would recognize the pattern and create a loop of 1
iteration around the code and then run the reroll pass.
If your pattern recognition is too good, it'll be redundant with the
reroll pass, so I'm not sure how to do that without duplicating effort
or destroying the IR (in case you're wrong). Adding 1-iteration loops
to all functions won't work either. You'll have to balance the
heuristics and make the pass optional, maybe with a pragma to help the
compiler.
cheers,
--renato
More information about the llvm-dev
mailing list