Skip to content

Commit 522e38b

Browse files
loop2_unroll: Add param to allow unrolling of loops containig multiple branches
Signed-off-by: Michiel Derhaeg <michiel@synopsys.com>
1 parent f0c47ad commit 522e38b

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

gcc/loop-unroll.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,7 @@ decide_unroll_stupid (class loop *loop, int flags)
11931193
of mispredicts.
11941194
TODO: this heuristic needs tunning; call inside the loop body
11951195
is also relatively good reason to not unroll. */
1196-
if (num_loop_branches (loop) > 1)
1196+
if (num_loop_branches (loop) > (unsigned) param_max_unroll_branches)
11971197
{
11981198
if (dump_file)
11991199
fprintf (dump_file, ";; Not unrolling, contains branches\n");

gcc/params.opt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,10 @@ Maximum number of arguments in a PHI supported by TREE if-conversion unless the
784784
Common Joined UInteger Var(param_max_unroll_times) Init(8) Param Optimization
785785
The maximum number of unrollings of a single loop.
786786

787+
-param=max-unroll-branches=
788+
Common Joined UInteger Var(param_max_unroll_branches) Init(1) Param Optimization
789+
The maximum number of branches allowed in a loop to be unrolled stupidly.
790+
787791
-param=max-unrolled-insns=
788792
Common Joined UInteger Var(param_max_unrolled_insns) Init(200) Param Optimization
789793
The maximum number of instructions to consider to unroll in a loop.

0 commit comments

Comments
 (0)