2015-04-14 18:24 GMT+01:00 Jeff Law <l...@redhat.com>: > On 04/14/2015 10:48 AM, Steven Bosscher wrote: >>> >>> So I think this stage2/3 binary difference is acceptable? >> >> >> No, they should be identical. If there's a difference, then there's a >> bug - which, it seems, you've already found, too. > > RIght. And so the natural question is how to fix. > > At first glance it would seem like having this new code ignore dependencies > rising from debug insns would work. > > Which then begs the question, what happens to the debug insn -- it's > certainly not going to be correct anymore if the transformation is made.
Exactly. The debug_insn 2776 in my example is to record the base address of a local array. the new code is doing correctly here by not shuffling the operands of insn 2556 and 2557 as there is additional reference of reg:1473 from debug insn, although the code will still execute correctly if we do the transformation. my understanding to fix this: * delete the out-of-date mismatch debug_insn? as there is no guarantee to generate accurate debug info under -O2. IMO, this debug_insn may affect "DW_AT_location" field for variable descrption of "classes" in .debug_info section, but it's omitted in the final output already. <3><38a4d>: Abbrev Number: 137 (DW_TAG_variable) <38a4f> DW_AT_name : (indirect string, offset: 0x18db): classes <38a53> DW_AT_decl_file : 1 <38a54> DW_AT_decl_line : 548 <38a56> DW_AT_type : <0x38cb4> * update the debug_insn? if the following change is OK with dwarf standard from insn0: reg0 = fp + reg1 debug_insn: var_loc = reg0 + const_off insn1: reg2 = reg0 + const_off to insn0: reg0 = fp + const_off debug_insn: var_loc = reg0 + reg1 insn1: reg2 = reg0 + reg1 Thanks, Regards, Jiong > > jeff >