[Issue 16189] Optimizer bug, with simple test case
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Feb 20 19:57:18 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=16189
bitter.taste at gmx.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bitter.taste at gmx.com
--- Comment #6 from bitter.taste at gmx.com ---
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 )
```
--
More information about the Digitalmars-d-bugs
mailing list