[llvm-dev] Loop Unroll (original) (raw)
Florian Hahn via llvm-dev llvm-dev at lists.llvm.org
Fri May 22 10:48:57 PDT 2020
- Previous message: [llvm-dev] Loop Unroll
- Next message: [llvm-dev] Loop Unroll
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On May 22, 2020, at 09:55, legend xx via llvm-dev <llvm-dev at lists.llvm.org> wrote:
Hi, I'm interesting in find a pass for loop unrolling in LLVM compiler. I tried opt --loop-unroll --unroll-count=4, but it don't work well. What pass I can used and how?
-loop-unroll should be the right pass. There are multiple possible reasons why the loop is not unrolled and the pass has a bunch of options to enable/force unrolling for more cases (see https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp#L81).
Passing -debug
should give you a better idea why the loop is not unrolled. If you would share the IR, someone might be able to provide additional insight.
I would also like to know if there is any way to mark the loops that I want them to be unroll
Yes it is possible to explicitly mark loops for unrolling using metadata in LLVM IR: https://llvm.org/docs/LangRef.html#llvm-loop-unroll. But the metadata might not help, if the loop contains code the unroller does not support.
Cheers, Florian
- Previous message: [llvm-dev] Loop Unroll
- Next message: [llvm-dev] Loop Unroll
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]