diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-10-24 07:02:48 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-10-24 07:02:48 +0000 |
commit | af54c969b934918194baf95143a6d88814edd77f (patch) | |
tree | 17bd6804bb91862e208f10a563382c2db21b95b3 | |
parent | 4e66664e723a9f9aeb8d119c6a2439ce508c28a9 (diff) | |
download | gcc-af54c969b934918194baf95143a6d88814edd77f.tar.gz |
2017-10-23 Richard Biener <rguenther@suse.de>
PR tree-optimization/82672
* graphite-isl-ast-to-gimple.c (graphite_copy_stmts_from_block):
Fold the stmt if we propagated into it.
* gfortran.dg/graphite/pr82672.f90: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254036 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/graphite-isl-ast-to-gimple.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c index b39ac5441c3..16570e16855 100644 --- a/gcc/graphite-isl-ast-to-gimple.c +++ b/gcc/graphite-isl-ast-to-gimple.c @@ -1175,22 +1175,28 @@ graphite_copy_stmts_from_block (basic_block bb, basic_block new_bb, ssa_op_iter iter; use_operand_p use_p; if (!is_gimple_debug (copy)) - FOR_EACH_SSA_USE_OPERAND (use_p, copy, iter, SSA_OP_USE) - { - tree old_name = USE_FROM_PTR (use_p); - - if (TREE_CODE (old_name) != SSA_NAME - || SSA_NAME_IS_DEFAULT_DEF (old_name) - || ! scev_analyzable_p (old_name, region->region)) - continue; - - gimple_seq stmts = NULL; - tree new_name = get_rename_from_scev (old_name, &stmts, - bb->loop_father, iv_map); - if (! codegen_error_p ()) - gsi_insert_earliest (stmts); - replace_exp (use_p, new_name); - } + { + bool changed = false; + FOR_EACH_SSA_USE_OPERAND (use_p, copy, iter, SSA_OP_USE) + { + tree old_name = USE_FROM_PTR (use_p); + + if (TREE_CODE (old_name) != SSA_NAME + || SSA_NAME_IS_DEFAULT_DEF (old_name) + || ! scev_analyzable_p (old_name, region->region)) + continue; + + gimple_seq stmts = NULL; + tree new_name = get_rename_from_scev (old_name, &stmts, + bb->loop_father, iv_map); + if (! codegen_error_p ()) + gsi_insert_earliest (stmts); + replace_exp (use_p, new_name); + changed = true; + } + if (changed) + fold_stmt_inplace (&gsi_tgt); + } update_stmt (copy); } |