[DAGCombine] Don't use getZExtValue() until we know the constant is in range.
Noticed during prep for a patch for PR40758. llvm-svn: 357571
This commit is contained in:
parent
eb9ae56157
commit
02599de2e1
|
@ -6843,8 +6843,8 @@ SDValue DAGCombiner::visitSHL(SDNode *N) {
|
||||||
if (N1C && N0.getOpcode() == ISD::SRL && N0.hasOneUse() &&
|
if (N1C && N0.getOpcode() == ISD::SRL && N0.hasOneUse() &&
|
||||||
TLI.shouldFoldShiftPairToMask(N, Level)) {
|
TLI.shouldFoldShiftPairToMask(N, Level)) {
|
||||||
if (ConstantSDNode *N0C1 = isConstOrConstSplat(N0.getOperand(1))) {
|
if (ConstantSDNode *N0C1 = isConstOrConstSplat(N0.getOperand(1))) {
|
||||||
|
if (N0C1->getAPIntValue().ult(OpSizeInBits)) {
|
||||||
uint64_t c1 = N0C1->getZExtValue();
|
uint64_t c1 = N0C1->getZExtValue();
|
||||||
if (c1 < OpSizeInBits) {
|
|
||||||
uint64_t c2 = N1C->getZExtValue();
|
uint64_t c2 = N1C->getZExtValue();
|
||||||
APInt Mask = APInt::getHighBitsSet(OpSizeInBits, OpSizeInBits - c1);
|
APInt Mask = APInt::getHighBitsSet(OpSizeInBits, OpSizeInBits - c1);
|
||||||
SDValue Shift;
|
SDValue Shift;
|
||||||
|
|
Loading…
Reference in New Issue