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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #2)
> Hmm, it sounds like DCE/DSE should insert
> 
> # DEBUG x$a => x$a_11
> 
> kind debug stmts.  IIRC SRA does more than that, adding DECL_DEBUG_EXPRs
> with magic.
> 
> Not sure if the debug stmts itself help enough here.

At cddce1, we have:
...
 __attribute__((noclone, noinline))
 foo (int fd, union U x)
 {
   int result;
   int _1;
   _Bool _2;
   _Bool _4;
   int _5;

   <bb 2> :
   # DEBUG BEGIN_STMT
   _1 = x.a;
   _2 = _1 != 0;
   result_8 = (int) _2;
   # DEBUG result => result_8
   # DEBUG BEGIN_STMT
   if (fd_9(D) != 0)
     goto <bb 3>; [INV]
   else
     goto <bb 4>; [INV]

   <bb 3> :
   # DEBUG BEGIN_STMT
   _4 = _1 == 0;
   result_10 = (int) _4;
   # DEBUG result => result_10

   <bb 4> :
   # result_6 = PHI <result_8(2), result_10(3)>
   # DEBUG result => result_6
   # DEBUG BEGIN_STMT
   __asm__ __volatile__("nop" :  :  : "memory");
   # DEBUG BEGIN_STMT
   _5 = x.a;
   z ={v} _5;
   # DEBUG BEGIN_STMT
-  x.a = 6;
   # DEBUG BEGIN_STMT
   __asm__ __volatile__("nop" :  :  : "memory");
   # DEBUG BEGIN_STMT
   return result_6;

 }
...

So, are you proposing to keep track of components like this:
...
-  x.a = 6;
+  # DEBUG x.a => 6
...
?

Reply via email to