Currently GIMPLE complete unroller(cunroll) is checking
flag_unroll_loops and flag_peel_loops to see if allow size growth.
Beside affects curnoll, flag_unroll_loops also controls RTL unroler.
To have more freedom to control cunroll and RTL unroller, this patch
introduces flag_cunroll_grow_size. With this patch, we can control
cunroll and RTL unroller indepently.
gcc/ChangeLog
2020-06-07 Jiufu Guo <guojiufu@linux.ibm.com>
* common.opt (flag_cunroll_grow_size): New flag.
* toplev.c (process_options): Set flag_cunroll_grow_size.
* tree-ssa-loop-ivcanon.c (pass_complete_unroll::execute):
Use flag_cunroll_grow_size.
Common Report Var(flag_unroll_all_loops) Optimization
Perform loop unrolling for all loops.
+funroll-completely-grow-size
+Undocumented Var(flag_cunroll_grow_size) Init(2) Optimization
+; Internal undocumented flag, allow size growth during complete unrolling
+
; Nonzero means that loop optimizer may assume that the induction variables
; that control loops do not overflow and that the loops with nontrivial
; exit condition are not infinite
if (flag_unroll_all_loops)
flag_unroll_loops = 1;
+ /* Allow cunroll to grow size accordingly. */
+ if (flag_cunroll_grow_size == AUTODETECT_VALUE)
+ flag_cunroll_grow_size
+ = flag_unroll_loops || flag_peel_loops || optimize >= 3;
+
/* web and rename-registers help when run after loop unrolling. */
if (flag_web == AUTODETECT_VALUE)
flag_web = flag_unroll_loops;
re-peeling the same loop multiple times. */
if (flag_peel_loops)
peeled_loops = BITMAP_ALLOC (NULL);
- unsigned int val = tree_unroll_loops_completely (flag_unroll_loops
- || flag_peel_loops
- || optimize >= 3, true);
+ unsigned int val = tree_unroll_loops_completely (flag_cunroll_grow_size,
+ true);
if (peeled_loops)
{
BITMAP_FREE (peeled_loops);