diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-12-06 09:16:44 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-12-06 09:16:44 +0100 |
commit | 650a8fcf8cabb103e1e1cbd40711f1decbb09d5e (patch) | |
tree | e6f46fca2559d08d344baa43f3aaad19950030fc /gcc/tree-cfg.c | |
parent | c3ad2f62354003fe63994d96255f807492d857e6 (diff) | |
download | gcc-650a8fcf8cabb103e1e1cbd40711f1decbb09d5e.zip gcc-650a8fcf8cabb103e1e1cbd40711f1decbb09d5e.tar.gz gcc-650a8fcf8cabb103e1e1cbd40711f1decbb09d5e.tar.bz2 |
re PR tree-optimization/81945 (ICE in operator[], at vec.h:749)
PR tree-optimization/81945
* cfgloop.h (FOR_EACH_LOOP_FN): Use FN instead of hardcoding fn.
* tree-cfg.c (move_sese_region_to_fn): If any of the loops moved
to dest_cfun has orig_loop_num set, either remap it to the new
loop number if the loop got moved too, or clear it.
* gcc.dg/graphite/pr81945.c: New test.
From-SVN: r255438
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r-- | gcc/tree-cfg.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 2501a9c..e313df9 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -7468,6 +7468,8 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, loops->state = LOOPS_MAY_HAVE_MULTIPLE_LATCHES; set_loops_for_fn (dest_cfun, loops); + vec<loop_p, va_gc> *larray = get_loops (saved_cfun)->copy (); + /* Move the outlined loop tree part. */ num_nodes = bbs.length (); FOR_EACH_VEC_ELT (bbs, i, bb) @@ -7514,6 +7516,20 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb, loop->aux = current_loops->tree_root; loop0->aux = current_loops->tree_root; + /* Fix up orig_loop_num. If the block referenced in it has been moved + to dest_cfun, update orig_loop_num field, otherwise clear it. */ + struct loop *dloop; + FOR_EACH_LOOP_FN (dest_cfun, dloop, 0) + if (dloop->orig_loop_num) + { + if ((*larray)[dloop->orig_loop_num] != NULL + && get_loop (saved_cfun, dloop->orig_loop_num) == NULL) + dloop->orig_loop_num = (*larray)[dloop->orig_loop_num]->num; + else + dloop->orig_loop_num = 0; + } + ggc_free (larray); + pop_cfun (); /* Move blocks from BBS into DEST_CFUN. */ |