aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineScheduler.cpp
diff options
context:
space:
mode:
authorMax Kazantsev <max.kazantsev@azul.com>2017-10-25 06:47:39 +0000
committerMax Kazantsev <max.kazantsev@azul.com>2017-10-25 06:47:39 +0000
commit9ac7021a2563d433549a21990f96184d413e69e2 (patch)
tree6cf15b8a787143d62aba54561e39ed9849b97b11 /llvm/lib/CodeGen/MachineScheduler.cpp
parent279790b67499989ce8387540a159028db4ad71a2 (diff)
downloadllvm-9ac7021a2563d433549a21990f96184d413e69e2.zip
llvm-9ac7021a2563d433549a21990f96184d413e69e2.tar.gz
llvm-9ac7021a2563d433549a21990f96184d413e69e2.tar.bz2
[IRCE] Fix intersection between signed and unsigned ranges
IRCE for unsigned latch conditions was temporarily disabled by rL314881. The motivating example contained an unsigned latch condition and a signed range check. One of the safe iteration ranges was `[1, SINT_MAX + 1]`. Its right border was incorrectly interpreted as a negative value in `IntersectRange` function, this lead to a miscompile under which we deleted a range check without inserting a postloop where it was needed. This patch brings back IRCE for unsigned latch conditions. Now we treat range intersection more carefully. If the latch condition was unsigned, we only try to consider a range check for deletion if: 1. The range check is also unsigned, or 2. Safe iteration range of the range check lies within `[0, SINT_MAX]`. The same is done for signed latch. Values from `[0, SINT_MAX]` are unambiguous, these values are non-negative under any interpretation, and all values of a range intersected with such range are also non-negative. We also use signed/unsigned min/max functions for range intersection depending on type of the latch condition. Differential Revision: https://reviews.llvm.org/D38581 llvm-svn: 316552
Diffstat (limited to 'llvm/lib/CodeGen/MachineScheduler.cpp')
0 files changed, 0 insertions, 0 deletions