On Fri, Oct 05, 2012 at 02:49:07PM +0200, Jakub Jelinek wrote: > I believe that gsi_insert_before in another function > isn't going to work well. > E.g. update_modified_stmt starts with > if (!ssa_operands_active (cfun)) > return; > > Or is it ok to use gsi_insert_before_without_update and expect that > when compilation resumes for the modified callee, it will > update all modified stmts? There is not much that needs > to be updated on the stmts, source bind has not setters nor uses > of any SSA_NAMEs or virtual defs/sets, the normal bind has a DEBUG_EXPR_DECL > on the RHS and so is not a use or def of anything as well.
To reply to my own post, without_update doesn't work, /usr/src/gcc/gcc/testsuite/gcc.dg/guality/pr54519-1.c: In function 'fn2.part.0': /usr/src/gcc/gcc/testsuite/gcc.dg/guality/pr54519-1.c:12:1: error: stmt (0x7f2d69c3c9d8) marked modified after optimization pass: # DEBUG D#3 s=> z /usr/src/gcc/gcc/testsuite/gcc.dg/guality/pr54519-1.c:12:1: internal # compiler error: verify_ssa failed then kicks in. def_temp = gimple_build_debug_source_bind (vexpr, parm, NULL); /* DEBUG D#N s=> parm stmt doesn't have any SSA defs or uses, no need to update it. */ gimple_set_modified (def_temp, false); gsi_insert_before (&cgsi, def_temp, GSI_SAME_STMT); def_temp = gimple_build_debug_bind (var, vexpr, NULL); /* DEBUG decl => D#N' stmt doesn't have any SSA defs or uses, no need to update it. */ gimple_set_modified (def_temp, false); gsi_insert_before (&cgsi, def_temp, GSI_SAME_STMT); seems to work, but not sure if that isn't too hackish to avoid one pair of push_cfun/pop_cfun. > If push_cfun/pop_cfun is not needed, guess the two loops could be merged, > the reason for two of them was just that I didn't want to push_cfun/pop_cfun > for each optimized away parameter. I was wrong apparently, the two loops are still needed, as the second loop needs to loop through the parameters in reverse order. Jakub