summaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
authorManman Ren <mren@apple.com>2012-12-12 01:13:50 +0000
committerManman Ren <mren@apple.com>2012-12-12 01:13:50 +0000
commit981b96376a99dacced70cc9b1e870968f426331a (patch)
tree6011dae8be083f85a26ea8b257e1ca124321a25d /lib/CodeGen/SelectionDAG/DAGCombiner.cpp
parent5da804150d418b8b4956b84013f8f67df553c543 (diff)
downloadllvm-981b96376a99dacced70cc9b1e870968f426331a.tar.gz
llvm-981b96376a99dacced70cc9b1e870968f426331a.tar.bz2
llvm-981b96376a99dacced70cc9b1e870968f426331a.tar.xz
DAGCombine: clamp hi bit in APInt::getBitsSet to avoid assertion
rdar://12838504 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169951 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/DAGCombiner.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 1c28d6dcaf..893cf2036a 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -7433,7 +7433,8 @@ SDValue DAGCombiner::ReduceLoadOpStoreWidth(SDNode *N) {
// start at the previous one.
if (ShAmt % NewBW)
ShAmt = (((ShAmt + NewBW - 1) / NewBW) * NewBW) - NewBW;
- APInt Mask = APInt::getBitsSet(BitWidth, ShAmt, ShAmt + NewBW);
+ APInt Mask = APInt::getBitsSet(BitWidth, ShAmt,
+ std::min(BitWidth, ShAmt + NewBW));
if ((Imm & Mask) == Imm) {
APInt NewImm = (Imm & Mask).lshr(ShAmt).trunc(NewBW);
if (Opc == ISD::AND)