http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54971
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-10-18 13:35:05 UTC --- >From quick skimming of tree-sra.c, I'd say we could add another bool flag like grp_to_be_replaced (say grp_to_be_debug_replaced), and in the else block of if (allow_replacements && scalar && !root->first_child && (root->grp_hint || ((root->grp_scalar_read || root->grp_assignment_read) && (root->grp_scalar_write || root->grp_assignment_write)))) do something like if (MAY_HAVE_DEBUG_STMTS && allow_replacements && scalar && !root->first_child && (root->grp_scalar_write || root->grp_assignment_write)) root->grp_to_be_debug_replaced = 1; (in addition to what the else block already does) and then in the actual modification of stmts for grp_to_be_debug_replaced prepend a debug stmt before the statement (or in the middle of statements). For the two stmts that modify such grp_to_be_debug_replaced = 1; access, a[0] = 1; and MEM[(char * {ref-all})&a] = MEM[(char * {ref-all})&D.1719]; we would have: DEBUG a$0 => 1 // Newly added stmt a[0] = 1; and SR.2_14 = 4; # DEBUG SR.2 => SR.2_14 SR.3_13 = 5; # DEBUG SR.3 => SR.3_13 SR.4_12 = 6; # DEBUG SR.4 => SR.4_12 # DEBUG a$0 => SR.2_14 // Newly added stmt a$1_9 = SR.3_13; # DEBUG a$1 => a$1_9 a$2_4 = SR.4_12; # DEBUG a$2 => a$2_4 Martin, is that possible, does it make sense and where are all the places in the sra_modify_* etc. code that would need to be tweaked?