<html><body><div>Hi Skye,</div><div><br></div><div>If I remember correctly, our loop unrolling pass requires loop rotation in order to be very effective.  Can you try adding that before you run the unroller to see if it helps?</div><div><br></div><div>--Owen</div><div><br>On Jan 14, 2014, at 09:32 PM, Skye Wanderman-Milne <skye@cloudera.com> wrote:<br><br></div><div><blockquote type="cite"><div class="msg-quote"><div dir="ltr">Hi all,<div><br></div><div>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.</div><div><br></div><div>My initial plan was to first run the IndVarSimplify pass (as suggested <a href="http://llvm.org/docs/Passes.html#loop-unroll-unroll-loops" data-mce-href="http://llvm.org/docs/Passes.html#loop-unroll-unroll-loops">here</a>) 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?</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>Does anyone have a suggestion for how to do this?</div><div><br></div><div>Thanks,<br></div><div>Skye</div></div><div class="_stretch">_______________________________________________<br> LLVM Developers mailing list<br> <a href="mailto:LLVMdev@cs.uiuc.edu" data-mce-href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" data-mce-href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a><br> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" data-mce-href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br></div></div></blockquote></div></body></html>