From 014b59e68837b998593b03b5eab3f7ff707d5d69 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 7 Oct 2016 07:47:38 +0000 Subject: [PATCH] gimple-low.c (lower_gimple_bind): Clear DECL_CHAIN of vars in gimple_bind_vars but not in BLOCK_VARS. 2016-10-07 Richard Biener * gimple-low.c (lower_gimple_bind): Clear DECL_CHAIN of vars in gimple_bind_vars but not in BLOCK_VARS. From-SVN: r240855 --- gcc/ChangeLog | 5 +++++ gcc/gimple-low.c | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9125650a545..e1eb08d28bc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-10-07 Richard Biener + + * gimple-low.c (lower_gimple_bind): Clear DECL_CHAIN of + vars in gimple_bind_vars but not in BLOCK_VARS. + 2016-10-07 Richard Biener PR tree-optimization/77879 diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c index 5f3361acba8..1bccf44e5d7 100644 --- a/gcc/gimple-low.c +++ b/gcc/gimple-low.c @@ -416,6 +416,23 @@ lower_gimple_bind (gimple_stmt_iterator *gsi, struct lower_data *data) } record_vars (gimple_bind_vars (stmt)); + + /* Scrap DECL_CHAIN up to BLOCK_VARS to ease GC after we no longer + need gimple_bind_vars. */ + tree next; + tree end = NULL_TREE; + if (gimple_bind_block (stmt)) + end = BLOCK_VARS (gimple_bind_block (stmt)); + for (tree var = gimple_bind_vars (stmt); var != end; var = next) + { + /* Ugh, something is violating the constraint that BLOCK_VARS + is a sub-chain of gimple_bind_vars. */ + if (! var) + break; + next = DECL_CHAIN (var); + DECL_CHAIN (var) = NULL_TREE; + } + lower_sequence (gimple_bind_body_ptr (stmt), data); if (new_block) -- 2.30.2