On Thu, Jul 23, 2015 at 08:20:50AM -0700, Cesar Philippidis wrote: > The attached patch does just that; it teaches > replace_block_vars_by_duplicates to replace the decls inside the > value-exprs with a duplicate too. It's kind of messy though. At the > moment I'm only considering VAR_DECL, PARM_DECL, RESULT_DECL, ADDR_EXPR, > ARRAY_REF, COMPONENT_REF, CONVERT_EXPR, NOP_EXPR, INDIRECT_REF and > MEM_REFs. I suspect that I may be missing some, but these are the only > ones that were triggered gcc_unreachable during testing.
Ugh, that looks ugly, why do we have all the tree walkers? I'd unshare_expr the value expr first, you really don't want to share it anyway, and then just walk_tree and find all the decls in there (with *walk_subtrees on types and perhaps something else too) and for them replace_by_duplicate_decl (tp, vars_map, to_context); Jakub