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

--- Comment #6 from Drea Pinski <pinskia at gcc dot gnu.org> ---
The problem is nontrap is incorrect in this case for this.

So the case we have is:
```
  if (c.1_3 == 0)
    goto <bb 5>; [50.00%]
  else
    goto <bb 6>; [50.00%]

  <bb 5> [local count: 59055800]:
  # VUSE <.MEM_8>
  _4 = h[2000];
  _5 = _4 & 1;
  # .MEM_9 = VDEF <.MEM_8>
  h[2000] = _5;

  <bb 6> [local count: 118111600]:
  # .MEM_6 = PHI <.MEM_8(4), .MEM_9(5)>
```

What need to do is reject if there is any loads in the middle-bb. Because that
invalidates nontrap here which assumed all stores of h[2000] was followed by a
load.

So pseduo-code:
for_all_uses (a: vuse (store))
{
  if (bb_of_use(a) == middle_bb)
    return false;
}

Reply via email to