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

--- Comment #21 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So after r15-580, we can optimize:
```
extern void* malloc (long unsigned int);
void fun (unsigned *x) {
  if (x == 0)  
    __builtin_unreachable();
  unsigned *a = malloc (*x);
  if (a == 0)
    return;
  if (a != x)
    *a = *x;
  *x = *a;
}
```

But it can't handle:
```
extern void* malloc (long unsigned int);
void fun (unsigned *x) {
  if (x == 0)  
    return;
  unsigned *a = malloc (*x);
  if (a == 0)
    return;
  if (a != x)            // (A)
    *a = *x;
  *x = *a;
}
```

Reply via email to