[LLVMdev] Loop-specific optimizations

Tim Besard tim.besard at elis.ugent.be
Wed Apr 3 01:00:21 PDT 2013


Hi al,

At our lab we're using LLVM to optimize and compile code to be run on a
CGRA processor, capable of executing parts of an application (mostly
loops) very efficiently. Since we are talking about a VLIW processor,
this code is generally being processed quite different than code for an
OoO-processor would be (e.g. modulo scheduled). This makes that
otherwise performance-enhancing optimizations can wreck our schedule.

We try to cope with this by selectively applying transformations to
loops. Initially we annotated loops with a pragma, and modified passes
to honour this pragma, but this proved to be cumbersome. It also didn't
work very well with function passes, which we then disabled altogether.

Recently we've been looking into outlining the relevant loop bodies to a
new function, and selecting transformations for this function. This
would only require modifying the pass manager, and would enable us to
specialize function passes as well.

Does this seem like a good way to specialize transformations for loop
bodies, or are there better ways to accomplish this? Some of the issues
I can already think of:
* overhead caused by argument passing -- can be fixed by inlining the
function again before register allocation?
* some optimizations (e.g. licm) won't be possible any more
* merging/rearranging loops won't be possibly (I'm thinking of Polly here)

Thanks,
-- 
Tim Besard
Computer Systems Lab
Department of Electronics & Information Systems
Ghent University



More information about the llvm-dev mailing list