Loop unrolling parameters

We’ve notice that when loops are unrolled there seems to be a limit of 64 subexpressions that can be assigned to registers. In our architecture we’ve got a lot more registers available than just 64. Is there some parameter we can change to the loop unroller that allows more subexpressions to be assigned to a number of registers beyond 64?

Phil

We've notice that when loops are unrolled there seems to be a limit of 64 subexpressions that can be assigned to registers. In our architecture we've got a lot more registers available than just 64. Is there some parameter we can change to the loop unroller that allows more subexpressions to be assigned to a number of registers beyond 64?

Hi Phil,

I’m not sure I understood your question correctly, but loop-unroller does have parameters that you can try. The most interesting and easy to use is probably ‘-unroll-threshold’. You can try
$ clang $YOUR_FLAGS -mllvm -unroll-threshold=500 test.c

With this parameter you can control how many loops get completely unrolled.

You also can find other flags to control loop-unrolling with the following command:
$ opt --help-hidden | grep unroll

Best regards,
Michael