Is it possible to unroll a loop (forcibly if necessary) with llvm (possibly the -loop-unroll pass) a constant number of times. I believe that I read that the -unroll-count=x option was removed, correct? So is there some other way to do this or is this just not possible in llvm? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120131/2b4677b9/attachment.html>
Ryan, I see the following command line options in LoopUnrollPass.cpp: static cl::opt<unsigned> UnrollThreshold("unroll-threshold", cl::init(150), cl::Hidden, cl::desc("The cut-off point for automatic loop unrolling")); static cl::opt<unsigned> UnrollCount("unroll-count", cl::init(0), cl::Hidden, cl::desc("Use this unroll count for all loops, for testing purposes")); static cl::opt<bool> UnrollAllowPartial("unroll-allow-partial", cl::init(false), cl::Hidden, cl::desc("Allows loops to be partially unrolled until " "-unroll-threshold loop size is reached.")); static cl::opt<bool> UnrollRuntime("unroll-runtime", cl::ZeroOrMore, cl::init(false), cl::Hidden, cl::desc("Unroll loops with run-time trip counts")); I assume the first two are most applicable to what you're trying to do. I've never used these options, so it would be a good idea to look at the source to see what these are really doing. Also, you'll probably need to put -mllvm before the argument to pass it to the backend (clang -mllvm -unroll-threshold=10). You can also use the -debug-only=loop-unroll option to get debug information. It too requires the -mllvm option. Hope this helps, Chad On Jan 31, 2012, at 5:16 PM, Ryan Taylor <ryta1203 at gmail.com> wrote:> Is it possible to unroll a loop (forcibly if necessary) with llvm (possibly the -loop-unroll pass) a constant number of times. > > I believe that I read that the -unroll-count=x option was removed, correct? So is there some other way to do this or is this just not possible in llvm? > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
On Jan 31, 2012, at 5:16 PM, Ryan Taylor <ryta1203 at gmail.com> wrote:> Is it possible to unroll a loop (forcibly if necessary) with llvm (possibly the -loop-unroll pass) a constant number of times. > > I believe that I read that the -unroll-count=x option was removed, correct? So is there some other way to do this or is this just not possible in llvm?See clang -mllvm -help-hidden. If that doesn't work, llc -help-hidden. Probably want something like -mllvm -unroll-runtime -mllvm -unroll-count=N. As with any experimental options, look at the source, and -mllvm -debug-only=loop-unroll output to understand what it's doing. Andy
Andrew, Thanks. Unfortunately, the runtime won't really work for what I'm doing but it seems that I can statically unroll just fine for the most part. Thanks. On Wed, Feb 1, 2012 at 8:38 AM, Andrew Trick <atrick at apple.com> wrote:> > > On Jan 31, 2012, at 5:16 PM, Ryan Taylor <ryta1203 at gmail.com> wrote: > > > Is it possible to unroll a loop (forcibly if necessary) with llvm > (possibly the -loop-unroll pass) a constant number of times. > > > > I believe that I read that the -unroll-count=x option was removed, > correct? So is there some other way to do this or is this just not possible > in llvm? > > See clang -mllvm -help-hidden. If that doesn't work, llc -help-hidden. > > Probably want something like -mllvm -unroll-runtime -mllvm -unroll-count=N. > > As with any experimental options, look at the source, and -mllvm > -debug-only=loop-unroll output to understand what it's doing. > > Andy >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120201/8e1d87f4/attachment.html>
Reasonably Related Threads
- [LLVMdev] Loop Unroll a constant number of times?
- [LLVMdev] Possible typo in LoopUnrollPass.cpp
- [LLVMdev] Loop-Unroll optimization
- [LLVMdev] Loop unrolling opportunity in SPEC's libquantum with profile info
- [LLVMdev] MI scheduler produce badly code with inline function