https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108463

--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, the reason for the -g0 vs. -g differences is that we create while
processing the huge DEBUG_INSN among other things 3 MEMs for
(mem:SI (plus:DI (reg:DI sp) (const_int some_offset)) [1  S4 A256])
(at that point still find, they have DEBUG_INSN setting_insn).
But later on we promote those debug only VALUEs to non-DEBUG in:
#0  promote_debug_loc (l=0x3968e60) at ../../gcc/cselib.cc:395
#1  0x00000000006df636 in cselib_lookup_mem (x=0x7fffe9f49210, create=0) at
../../gcc/cselib.cc:1697
#2  0x00000000006e13e6 in cselib_lookup_1 (x=0x7fffe9f49210, mode=E_SImode,
create=0, memmode=E_VOIDmode) at ../../gcc/cselib.cc:2398
#3  0x00000000006e166d in cselib_lookup (x=0x7fffe9f49210, mode=E_SImode,
create=0, memmode=E_VOIDmode) at ../../gcc/cselib.cc:2456
#4  0x00000000006dd28e in rtx_equal_for_cselib_1 (x=0x7fffe9f49210,
y=0x7fffe9f3fbe8, memmode=E_VOIDmode, depth=0) at ../../gcc/cselib.cc:954
#5  0x00000000006e4301 in cselib_hasher::equal (v=0x3938fb0,
x_arg=0x7fffffffc110) at ../../gcc/cselib.cc:146
#6  0x00000000006e4662 in hash_table<cselib_hasher, false,
xcallocator>::find_slot_with_hash (this=0x38edbc0, comparable=@0x7fffffffc130:
0x7fffffffc110, hash=96, insert=INSERT)
    at ../../gcc/hash-table.h:1077
#7  0x00000000006dc507 in cselib_find_slot (mode=E_SImode, x=0x7fffe9f3fbe8,
hash=96, insert=INSERT, memmode=E_VOIDmode) at ../../gcc/cselib.cc:640
#8  0x00000000006df6c8 in cselib_lookup_mem (x=0x7fffe9f3fbe8, create=1) at
../../gcc/cselib.cc:1707
#9  0x00000000006e13e6 in cselib_lookup_1 (x=0x7fffe9f3fbe8, mode=E_SImode,
create=1, memmode=E_VOIDmode) at ../../gcc/cselib.cc:2398
#10 0x00000000006e166d in cselib_lookup (x=0x7fffe9f3fbe8, mode=E_SImode,
create=1, memmode=E_VOIDmode) at ../../gcc/cselib.cc:2456
#11 0x00000000006e29ad in cselib_record_sets (insn=0x7fffe9f21cc0) at
../../gcc/cselib.cc:2957
#12 0x00000000006e3505 in cselib_process_insn (insn=0x7fffe9f21cc0) at
../../gcc/cselib.cc:3184
This is when processing non-DEBUG_INSN, but the only reason we lookup stuff
there is because the debug only VALUE is seen in the hash table
and compared to a VALUE actually seen in the non-DEBUG_INSN.
So, I wonder if we shouldn't with some global flag or what temporarily disable
the promotion of debug locs in non-create mode while doing the comparisons of
existing hash table values.  But not sure where exactly.

Reply via email to