diff options
author | Ian Lance Taylor <iant@google.com> | 2016-01-27 17:42:47 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2016-01-27 17:42:47 +0000 |
commit | 1a218fc914c5693297312ea6869c94f0cf15b35a (patch) | |
tree | 9c27e28bec476497f23cf551790e63816551db2b /gcc/tree-ssa-loop-ivopts.c | |
parent | 5d70666e4c20dd634283e09336c78f79fce77d77 (diff) | |
download | gcc-1a218fc914c5693297312ea6869c94f0cf15b35a.zip gcc-1a218fc914c5693297312ea6869c94f0cf15b35a.tar.gz gcc-1a218fc914c5693297312ea6869c94f0cf15b35a.tar.bz2 |
common.opt (fkeep-gc-roots-live): New undocumented option.
gcc/:
* common.opt (fkeep-gc-roots-live): New undocumented option.
* tree-ssa-loop-ivopts.c (add_candidate_1): If
-fkeep-gc-roots-live, skip pointers.
(add_iv_candidate_for_biv): Handle add_candidate_1 returning
NULL.
gcc/testsuite/:
* gcc.dg/tree-ssa/ivopt_5.c: New test.
From-SVN: r232888
Diffstat (limited to 'gcc/tree-ssa-loop-ivopts.c')
-rw-r--r-- | gcc/tree-ssa-loop-ivopts.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index 3faed93..4026d28 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -2815,6 +2815,16 @@ add_candidate_1 (struct ivopts_data *data, struct iv_cand *cand = NULL; tree type, orig_type; + /* -fkeep-gc-roots-live means that we have to keep a real pointer + live, but the ivopts code may replace a real pointer with one + pointing before or after the memory block that is then adjusted + into the memory block during the loop. FIXME: It would likely be + better to actually force the pointer live and still use ivopts; + for example, it would be enough to write the pointer into memory + and keep it there until after the loop. */ + if (flag_keep_gc_roots_live && POINTER_TYPE_P (TREE_TYPE (base))) + return NULL; + /* For non-original variables, make sure their values are computed in a type that does not invoke undefined behavior on overflows (since in general, we cannot prove that these induction variables are non-wrapping). */ @@ -3083,8 +3093,11 @@ add_iv_candidate_for_biv (struct ivopts_data *data, struct iv *iv) cand = add_candidate_1 (data, iv->base, iv->step, true, IP_ORIGINAL, NULL, SSA_NAME_DEF_STMT (def)); - cand->var_before = iv->ssa_name; - cand->var_after = def; + if (cand) + { + cand->var_before = iv->ssa_name; + cand->var_after = def; + } } else gcc_assert (gimple_bb (phi) == data->current_loop->header); |