summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
diff options
context:
space:
mode:
authorDaniel Neilson <dneilson@azul.com>2017-09-05 19:54:03 +0000
committerDaniel Neilson <dneilson@azul.com>2017-09-05 19:54:03 +0000
commit3f0e4ad833e0f367255522b4b3dd3e625a1c40c1 (patch)
treedc69edb69d3c11f67a933da457d887772c783170 /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
parentd0e9c167d8a6ab934bfa20ec0b774488176777a8 (diff)
downloadbcm5719-llvm-3f0e4ad833e0f367255522b4b3dd3e625a1c40c1.tar.gz
bcm5719-llvm-3f0e4ad833e0f367255522b4b3dd3e625a1c40c1.zip
[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
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud