summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2011-04-13 23:22:23 +0000
committerOwen Anderson <resistor@mac.com>2011-04-13 23:22:23 +0000
commit9c12834eed69539da9ad0333ba5d0b2a00de5070 (patch)
tree994c19ee505ab725c8009572a2896b6fe46d017d
parentab65b34fdc9369f065ee5da8c06e6c007a26e94b (diff)
downloadbcm5719-llvm-9c12834eed69539da9ad0333ba5d0b2a00de5070.tar.gz
bcm5719-llvm-9c12834eed69539da9ad0333ba5d0b2a00de5070.zip
During post-legalization DAG combining, be careful to only create shifts where the RHS is of the legal type for the new operation.
llvm-svn: 129484
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 4b0822d023e..9bd7dd9a523 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -1678,6 +1678,13 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
ConstantSDNode *ShAmt = dyn_cast<ConstantSDNode>(In.getOperand(1));
if (!ShAmt)
break;
+ SDValue Shift = In.getOperand(1);
+ if (TLO.LegalTypes()) {
+ uint64_t ShVal = ShAmt->getZExtValue();
+ Shift =
+ TLO.DAG.getConstant(ShVal, getShiftAmountTy(Op.getValueType()));
+ }
+
APInt HighBits = APInt::getHighBitsSet(OperandBitWidth,
OperandBitWidth - BitWidth);
HighBits = HighBits.lshr(ShAmt->getZExtValue()).trunc(BitWidth);
@@ -1691,7 +1698,7 @@ bool TargetLowering::SimplifyDemandedBits(SDValue Op,
return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SRL, dl,
Op.getValueType(),
NewTrunc,
- In.getOperand(1)));
+ Shift));
}
break;
}
OpenPOWER on IntegriCloud