------- Comment #11 from rguenth at gcc dot gnu dot org  2006-09-29 16:24 
-------
I don't really know.  But for this issue I would like to introduce middle-end
no-op builtins __builtin_clobber (void*) clobber the pointer argument alias set
like we do for malloc/free (and other calls):

int foo(void)
{
  int i, *p, *q;
  p = malloc(4);
  *p = 0;
  free(p);
  q = malloc(4);
  *q = 1;
  i = *q;
  free(q);
  return i;
}

<bb 2>:
  #   HEAP.4_10 = V_MAY_DEF <HEAP.4_8>;
  #   HEAP.5_11 = V_MAY_DEF <HEAP.5_9>;
  D.1530_1 = malloc (4);
  p_2 = (int *) D.1530_1;
  #   HEAP.4_12 = V_MAY_DEF <HEAP.4_10>;
  *p_2 = 0;
  #   HEAP.4_13 = V_MAY_DEF <HEAP.4_12>;
  #   HEAP.5_14 = V_MAY_DEF <HEAP.5_11>;
  free (p_2);
  #   HEAP.4_15 = V_MAY_DEF <HEAP.4_13>;
  #   HEAP.5_16 = V_MAY_DEF <HEAP.5_14>;
  D.1531_3 = malloc (4);
  q_4 = (int *) D.1531_3;
  #   HEAP.5_17 = V_MAY_DEF <HEAP.5_16>;
  *q_4 = 1;
  #   VUSE <HEAP.5_17>;
  i_5 = *q_4;
  #   HEAP.4_18 = V_MAY_DEF <HEAP.4_15>;
  #   HEAP.5_19 = V_MAY_DEF <HEAP.5_17>;
  free (q_4);
  D.1532_6 = i_5;
  return D.1532_6;


or even just a way to add a VUSE of the pointer alias sets, or even
void * __builtin_new_object (void *p) which would do

  # VUSE <p>
  # HEAP.n = V_MAY_DEF <HEAP.n>
  p = __builtin_new_object (p)

i.e. associate a new alias tag with the return value.

Can you benchmark the workaround in the library?


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dberlin at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29286

Reply via email to