Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Skye Wanderman-Milne <skye <at> cloudera.com>
Subject: Loop unrolling a function
Newsgroups: gmane.comp.compilers.llvm.devel
Date: Wednesday 15th January 2014 05:32:36 UTC (over 3 years ago)
Hi all,

I'm attempting to perform loop unrolling on a single function using the C++
API. Maybe I missed something in the docs, but I cannot figure out a way to
do this. The function I'm working with is very simple, containing a single
for loop and not much else. I compiled the function to IR using clang with
no optimizations enabled.

My initial plan was to first run the IndVarSimplify pass (as suggested
here<http://llvm.org/docs/Passes.html#loop-unroll-unroll-loops>)
and then the LoopUnroll pass on the function. I tried using a
FunctionPassManager to do this, even though the docs state FPMs are used
with FunctionPasses and not LoopPasses, which didn't complain but had no
effect on the function. Is adding LoopPasses to a FPM supposed to be a
no-op? Is this supposed to work and I'm not running the right combination
of passes to get loop unrolling?

I also tried creating a LoopInfo object over my function with a FPM so I
could call UnrollLoop() manually, but the LoopInfo didn't return any loops,
perhaps because I'm missing some preliminary passes.

The last option I considered was copying the function into it's own module,
using a PassManager, and then copying the function back into the original
module. I didn't try this option as creating a valid stand-alone module
with the single function will potentially be difficult.

Does anyone have a suggestion for how to do this?

Thanks,
Skye
 
CD: 3ms