diff options
author | Manman Ren <mren@apple.com> | 2012-12-12 01:13:50 +0000 |
---|---|---|
committer | Manman Ren <mren@apple.com> | 2012-12-12 01:13:50 +0000 |
commit | 82751a105c2217ce1383739c96ece0fc44606b70 (patch) | |
tree | ff642ce1c83d99cf1dff40ddf31ef31515739eec /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | aeb17df8027debc3e0f6ca139d493cec56c2b8d6 (diff) | |
download | bcm5719-llvm-82751a105c2217ce1383739c96ece0fc44606b70.tar.gz bcm5719-llvm-82751a105c2217ce1383739c96ece0fc44606b70.zip |
DAGCombine: clamp hi bit in APInt::getBitsSet to avoid assertion
rdar://12838504
llvm-svn: 169951
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 1c28d6dcaf4..893cf2036a4 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/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) |