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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2023-09-27 00:00:00         |2023-11-7

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
DSE removes the store before set_field1_and_field2:

   b_3 = malloc (4);
-  b_3->field3 = 1;
   set_field1_and_field2 (b_3);

modref analyzing 'set_field1_and_field2/22' (ipa=0)
Past summary:
  loads:
  stores:
      Base 0: alias set 1
        Ref 0: alias set 1
          access: Parm 0 param offset:0 offset:0 size:1 max_size:2
  kills:
     Parm 0 param offset:0 offset:0 size:2 max_size:2
  Try dse
  parm 0 flags: no_indirect_clobber no_direct_escape no_indirect_escape
no_direct_read no_indirect_read

and local analysis:

 - Analyzing load: MEM <unsigned char> [(struct bitfield *)b_2(D)]
   - Recording base_set=1 ref_set=1  Parm 0 param offset:0 offset:0 size:8
max_size:8
 - Analyzing store: MEM <unsigned char> [(struct bitfield *)b_2(D)]
   - Recording base_set=1 ref_set=1  Parm 0 param offset:0 offset:0 size:8
max_size:8
   - Recording kill
 - modref done with result: tracked.
  loads:
      Base 0: alias set 1
        Ref 0: alias set 1
          access: Parm 0 param offset:0 offset:0 size:8 max_size:8
  stores:
      Base 0: alias set 1
        Ref 0: alias set 1
          access: Parm 0 param offset:0 offset:0 size:8 max_size:8
  kills:
     Parm 0 param offset:0 offset:0 size:8 max_size:8
  Try dse
  parm 0 flags: no_indirect_clobber no_direct_escape no_indirect_escape
no_direct_read no_indirect_read

note how we merge flags of the param to include the IPA time no_direct_read.

Basically the store-merging transform changes the store to kill all bits
but by reading the original bits and storing them again.

The change by Martin made us use the IPA param flags, but as shown we
really can't do this, at least not for all flag kinds.  So I don't think
we can use the IPA state for the function we're re-analyzing, but we
can probably use the IPA of function calls we run into during analyzing?

Honza, please have a look here.

Reply via email to