------- Comment #9 from jakub at gcc dot gnu dot org 2008-09-09 13:03 ------- Yes, it does (after all, it sometimes needs to insert statements even after stmt). Your patch is IMHO correct, but incomplete. There are 2 things that also need doing: 1) I think in while (!gsi_end_p (copy_gsi)) loop we want to iterate from the first stmt inserted from remaping orig_stmt, whether it is created by force_gimple_operand_gsi or gimple_regimplify_operands. ATM we just handle the last one. I guess we want 2 gimple_stmt_iterator's, one will keep advancing to the last stmt and one will be copy_gsi value when gimple_duplicate_stmt_histograms was called. 2) insert_init_stmt also calls gimple_regimplify_operands. It shouldn't create new gimplify_context, as gimple_regimplify_operands does that, and I'm not sure it needs to call find_new_referenced_vars (gimple_regimplify_operands calls mark_symbols_for_renaming and add_referenced_var on the temps). Certainly init_stmt needs to be inserted into the sequence before calling gimple_regimplify_operands though.
-- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37356