diff options
author | 2022-07-21 10:31:21 +0100 | |
---|---|---|
committer | 2022-07-26 14:35:33 +0000 | |
commit | 4f18b94f4f8140644cabbfff5077178a19dd37e4 (patch) | |
tree | fa7272cdbfadf95b25b7fa6f5e83566e1f65c51d /compiler/optimizing/graph_visualizer.h | |
parent | 254f9a9222c8247f5cdff68e4c6c942de5b6ecf9 (diff) |
Make linear loop optimization safe from overflow
In the calcuation of `a * i + b`, `a` itself is calculated by doing:
`(end - start) + (step - 1) / step`
(Note that we add `step - 1` as a way of doing `ceiling`).
This way of calculating `a` can overflow and produce the wrong result
if end and start are in opposite sides of the spectrum.
We can force `a` to be a constant to guarantee that the right result
will be generated when doing loop optimization.
Bug: 231415860
Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b
Change-Id: Ic056441f8d672b3c48cbbd2f3e4ebd7528e2c65b
Diffstat (limited to 'compiler/optimizing/graph_visualizer.h')
0 files changed, 0 insertions, 0 deletions