diff options
author | George Burgess IV <george.burgess.iv@gmail.com> | 2017-09-28 06:17:19 +0000 |
---|---|---|
committer | George Burgess IV <george.burgess.iv@gmail.com> | 2017-09-28 06:17:19 +0000 |
commit | f8e11b803d708bbe78407cfac4fab5b56044c5da (patch) | |
tree | bdb0cf2bf80e4a059fefe8b4569174ae4e3685cf /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | 2e9cd5693fb47ba0c8a2e6b6a0d3296bebbb1cec (diff) | |
download | bcm5719-llvm-f8e11b803d708bbe78407cfac4fab5b56044c5da.tar.gz bcm5719-llvm-f8e11b803d708bbe78407cfac4fab5b56044c5da.zip |
[DAGCombiner] Fix an off-by-one error in vector logic
Without this, we could end up trying to get the Nth (0-indexed) element
from a subvector of size N.
Differential Revision: https://reviews.llvm.org/D37880
llvm-svn: 314380
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index c171d76e2ce..35d7ccb78c4 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -14501,8 +14501,8 @@ SDValue DAGCombiner::reduceBuildVecToShuffle(SDNode *N) { } NearestPow2 = PowerOf2Ceil(MaxIndex); - if (InVT.isSimple() && (NearestPow2 > 2) && - ((NumElems * 2) < NearestPow2)) { + if (InVT.isSimple() && NearestPow2 > 2 && MaxIndex < NearestPow2 && + NumElems * 2 < NearestPow2) { unsigned SplitSize = NearestPow2 / 2; EVT SplitVT = EVT::getVectorVT(*DAG.getContext(), InVT.getVectorElementType(), SplitSize); |