llvm-project/llvm/lib
Daniel Neilson 3f0e4ad833 [SCEV] Ensure ScalarEvolution::createAddRecFromPHIWithCastsImpl properly handles out of range truncations of the start and accum values
Summary:
 When constructing the predicate P1 in ScalarEvolution::createAddRecFromPHIWithCastsImpl() it is possible
for the PHISCEV from which the predicate is constructed to be a SCEVConstant instead of a SCEVAddRec. If
this happens, then the cast<SCEVAddRec>(PHISCEV) in the code will assert.

 Such a PHISCEV is possible if either the start value or the accumulator value is a constant value
that not equal to its truncated value, and if the truncated value is zero.

 This patch adds tests that demonstrate the cast<> assertion, and fixes this problem by checking
whether the PHISCEV is a constant before constructing the P1 predicate; if it is, then P1 is
equivalent to one of P2 or P3. Additionally, if we know that the start value or accumulator
value are constants then we check whether the P2 and/or P3 predicates are known false at compile
time; if either is, then we bail out of constructing the AddRec.

Reviewers: sanjoy, mkazantsev, silviu.baranga

Reviewed By: mkazantsev

Subscribers: mkazantsev, llvm-commits

Differential Revision: https://reviews.llvm.org/D37265

llvm-svn: 312568
2017-09-05 19:54:03 +00:00
..
Analysis [SCEV] Ensure ScalarEvolution::createAddRecFromPHIWithCastsImpl properly handles out of range truncations of the start and accum values 2017-09-05 19:54:03 +00:00
AsmParser Canonicalize the representation of empty an expression in DIGlobalVariableExpression 2017-08-30 18:06:51 +00:00
BinaryFormat [BinaryFormat] Fix out of bounds read. 2017-08-31 12:50:42 +00:00
Bitcode Canonicalize the representation of empty an expression in DIGlobalVariableExpression 2017-08-30 18:06:51 +00:00
CodeGen Revert "Re-enable "[MachineCopyPropagation] Extend pass to do COPY source forwarding"" 2017-09-04 15:47:00 +00:00
DebugInfo [DebugInfo] - Fix for lld DWARF parsing of base address selection entries in range lists. 2017-09-04 10:30:39 +00:00
Demangle [ItaniumDemangle] Fix a exponential string copying bug 2017-05-28 23:24:52 +00:00
ExecutionEngine [ORC] Add a pair of ORC layers that forward object-layer operations via RPC. 2017-09-05 03:34:09 +00:00
FuzzMutate Move some CLI utils out of llvm-isel-fuzzer and into the library 2017-09-02 23:43:04 +00:00
Fuzzer Moving libFuzzer from LLVM to compiler-rt. 2017-08-21 23:25:12 +00:00
IR Debug info for variables whose type is shrinked to bool 2017-09-01 10:05:27 +00:00
IRReader
LTO LTO: Try to open cache files before renaming them. 2017-09-05 19:51:38 +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 [WebAssembly] Update relocation names to match spec 2017-09-01 17:32:01 +00:00
Object [Decompression] Fail gracefully when out of memory 2017-09-05 11:21:38 +00:00
ObjectYAML [yaml2obj][ELF] Make symbols optional for relocations 2017-08-30 23:13:31 +00:00
Option Revert "Revert r311552: [Bash-autocompletion] Add support for static analyzer flags" 2017-08-29 00:09:31 +00:00
Passes [PM] Switch the CGSCC debug messages to use the standard LLVM debug 2017-08-11 05:47:13 +00:00
ProfileData Fix the bug when SampleProfileWriter writes out number of callsites. 2017-08-03 00:09:18 +00:00
Support Untabify. 2017-08-28 06:47:47 +00:00
TableGen Untabify. 2017-08-28 06:47:47 +00:00
Target [X86] Remove unnecessary (v4f32 (X86vzmovl (v4f32 (scalar_to_vector FR32X)))) patterns 2017-09-05 19:09:02 +00:00
Testing Mark LLVMTestingSupport as not installed in LLVMBuild. 2017-06-19 22:01:50 +00:00
ToolDrivers Simplify writeArchive return type. 2017-08-30 22:11:03 +00:00
Transforms [InstCombine] Move foldSelectICmpAnd helper function earlier in the file to enable reuse in a future patch. 2017-09-05 05:26:37 +00:00
WindowsManifest Return copy of XML dump 2017-09-02 05:14:55 +00:00
XRay [XRay][tools] Support new kinds of instrumentation map entries 2017-08-21 00:14:06 +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