mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
Use the correct ShiftAmtTy for creating shifts after legalization. PR11881. Not committing a testcase because I think it will be too fragile.
llvm-svn: 149315
This commit is contained in:
parent
ab823c2ad4
commit
b3c6efa558
@ -1612,15 +1612,17 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
|
||||
|
||||
APInt MsbMask = APInt::getHighBitsSet(BitWidth, 1);
|
||||
// If we only care about the highest bit, don't bother shifting right.
|
||||
if (MsbMask == DemandedMask) {
|
||||
if (MsbMask == DemandedMask) {
|
||||
unsigned ShAmt = ExVT.getScalarType().getSizeInBits();
|
||||
SDValue InOp = Op.getOperand(0);
|
||||
// In this code we may handle vector types. We can't use the
|
||||
// getShiftAmountTy API because it only works on scalars.
|
||||
// We use the shift value type because we know that its an integer
|
||||
// with enough bits.
|
||||
SDValue ShiftAmt = TLO.DAG.getConstant(BitWidth - ShAmt,
|
||||
Op.getValueType());
|
||||
|
||||
// Compute the correct shift amount type, which must be getShiftAmountTy
|
||||
// for scalar types after legalization.
|
||||
EVT ShiftAmtTy = Op.getValueType();
|
||||
if (TLO.LegalTypes() && !ShiftAmtTy.isVector())
|
||||
ShiftAmtTy = getShiftAmountTy(ShiftAmtTy);
|
||||
|
||||
SDValue ShiftAmt = TLO.DAG.getConstant(BitWidth - ShAmt, ShiftAmtTy);
|
||||
return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SHL, dl,
|
||||
Op.getValueType(), InOp, ShiftAmt));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user