https://issues.dlang.org/show_bug.cgi?id=16189

[email protected] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #6 from [email protected] ---
The LICM pass is too eager and given this small snippet
```
void main()
{
    ubyte[9][1] data;
    size_t a = 0;
    loop:
    data[0] = data[a];
    a--;
    bool b = false;
    if (b) goto loop;
    assert(a == -1); // Fails with -O
}
```
`a' is considered to be as an "index" variable into `data' with starting value
0 and that's decremented until `a < 1', this condition is most likely derived
by the bound-checking condition.
As a result we get

```
Adding (a(1) =  ((_TMP1(3) -  #data(0)) /  9LL )) to exit block B4
```

that doesn't play well with the constant folding pass

```
const prop (_TMP1(3) replaced by #data(0).xfffffffffffffff7)
```

as shown by

```
const prop (a(1) replaced by 2049638230412172400LL )
```

--

Reply via email to