aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2013-01-27 15:04:43 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2013-01-27 15:04:43 +0000
commit022688c260f472b4befcd974a6c907c6830f308e (patch)
tree925e28535c020467a7499d183e46811b852482b4 /lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
parent6a325cc46db9cb0c631ac832474e5df039d04b19 (diff)
downloadexternal_llvm-022688c260f472b4befcd974a6c907c6830f308e.zip
external_llvm-022688c260f472b4befcd974a6c907c6830f308e.tar.gz
external_llvm-022688c260f472b4befcd974a6c907c6830f308e.tar.bz2
Legalizer: Add an assert and tweak a comment to clarify the assumptions this code makes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173620 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
index e08dd6d..88e72ec 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
@@ -2098,9 +2098,13 @@ void DAGTypeLegalizer::ExpandIntRes_Shift(SDNode *N,
EVT VT = LHSL.getValueType();
// If the shift amount operand is coming from a vector legalization it may
- // not have the right return type. Fix that first by casting the operand.
+ // have an illegal type. Fix that first by casting the operand. Otherwise
+ // the new SHL_PARTS operation would need further legalization, and the
+ // legalizer assumes that illegal SHL_PARTS never occur.
SDValue ShiftOp = N->getOperand(1);
MVT ShiftTy = TLI.getShiftAmountTy(VT);
+ assert(ShiftTy.getSizeInBits() >= Log2_32_Ceil(VT.getSizeInBits()) &&
+ "ShiftAmountTy is too small to cover the range of this type!");
if (ShiftOp.getValueType() != ShiftTy)
ShiftOp = DAG.getZExtOrTrunc(ShiftOp, dl, ShiftTy);