llvm-project/llvm/lib
Max Kazantsev 9ac7021a25 [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
2017-10-25 06:47:39 +00:00
..
Analysis [MemDep] DBG intrinsics don't impact abort limit for call site dependence analysis 2017-10-25 06:15:32 +00:00
AsmParser Fix assembler for alloca of multiple elements in non-zero addr space 2017-10-14 03:23:18 +00:00
BinaryFormat Simplify. 2017-10-19 01:32:18 +00:00
Bitcode Reverting r315590; it did not include changes for llvm-tblgen, which is causing link errors for several people. 2017-10-15 14:32:27 +00:00
CodeGen Implement salavageDebugInfo functionality for SelectionDAG. 2017-10-24 22:55:12 +00:00
DebugInfo [codeview] Fix handling of S_HEAPALLOCSITE 2017-10-24 17:02:40 +00:00
Demangle [ItaniumDemangle] Fix a exponential string copying bug 2017-05-28 23:24:52 +00:00
ExecutionEngine ExecutionEngine: make COFF Thumb2 assertions non-tautological 2017-10-22 20:51:25 +00:00
FuzzMutate FuzzMutate: Fix arch parsing in FuzzerCLI 2017-10-17 02:39:40 +00:00
Fuzzer [libFuzzer] Delete llvm/lib/Fuzzer 2017-10-16 20:48:19 +00:00
IR [ConstantFolding] Avoid assert when folding ptrtoint of vectorized GEP 2017-10-24 12:08:11 +00:00
IRReader Move the stripping of invalid debug info from the Verifier to AutoUpgrade. 2017-10-02 18:31:29 +00:00
LTO [raw_fd_ostream] report actual error in error messages 2017-10-24 01:26:22 +00:00
LineEditor
Linker Linker: Create a function declaration when moving a non-prevailing alias of function type. 2017-08-10 01:07:44 +00:00
MC [MC] Adding code padding for performance stability - infrastructure. NFC. 2017-10-24 06:16:03 +00:00
Object llvm-readobj: Add support for reading relocations in the Android packed format. 2017-10-25 03:37:12 +00:00
ObjectYAML llvm-readobj: Add support for reading relocations in the Android packed format. 2017-10-25 03:37:12 +00:00
Option Reverting r315590; it did not include changes for llvm-tblgen, which is causing link errors for several people. 2017-10-15 14:32:27 +00:00
Passes [PM] Add pgo-memop-opt pass to the new pass manager 2017-10-23 22:21:29 +00:00
ProfileData [Coverage] Provide a stable order for getInstantiationGroups 2017-10-24 22:35:29 +00:00
Support Check special-case-list regex before insertion. 2017-10-24 23:56:12 +00:00
TableGen Reverting r315590; it did not include changes for llvm-tblgen, which is causing link errors for several people. 2017-10-15 14:32:27 +00:00
Target bpf: fix an uninitialized variable issue 2017-10-24 21:36:33 +00:00
Testing Mark LLVMTestingSupport as not installed in LLVMBuild. 2017-06-19 22:01:50 +00:00
ToolDrivers [COFF] Improve the check for functions that should get an extra underscore 2017-10-23 09:08:13 +00:00
Transforms [IRCE] Fix intersection between signed and unsigned ranges 2017-10-25 06:47:39 +00:00
WindowsManifest Fix bug 34608 by moving private header out of public header. 2017-09-14 23:01:13 +00:00
XRay [XRay][tools] Support arg1 logging entries in the basic logging mode 2017-10-05 05:18:17 +00:00
CMakeLists.txt Moving libFuzzer from LLVM to compiler-rt. 2017-08-21 23:25:12 +00:00
LLVMBuild.txt Re-apply "Introduce FuzzMutate library" 2017-08-21 22:57:06 +00:00