forked from OSchip/llvm-project
Shift by the word size is invalid IR; don't create it.
llvm-svn: 122353
This commit is contained in:
parent
3635eae697
commit
d64931df77
|
@ -2967,7 +2967,7 @@ SDValue DAGCombiner::visitSHL(SDNode *N) {
|
|||
N0.getOperand(1).getOpcode() == ISD::Constant) {
|
||||
uint64_t c1 = cast<ConstantSDNode>(N0.getOperand(1))->getZExtValue();
|
||||
uint64_t c2 = N1C->getZExtValue();
|
||||
if (c1 + c2 > OpSizeInBits)
|
||||
if (c1 + c2 >= OpSizeInBits)
|
||||
return DAG.getConstant(0, VT);
|
||||
return DAG.getNode(ISD::SHL, N->getDebugLoc(), VT, N0.getOperand(0),
|
||||
DAG.getConstant(c1 + c2, N1.getValueType()));
|
||||
|
@ -3165,7 +3165,7 @@ SDValue DAGCombiner::visitSRL(SDNode *N) {
|
|||
N0.getOperand(1).getOpcode() == ISD::Constant) {
|
||||
uint64_t c1 = cast<ConstantSDNode>(N0.getOperand(1))->getZExtValue();
|
||||
uint64_t c2 = N1C->getZExtValue();
|
||||
if (c1 + c2 > OpSizeInBits)
|
||||
if (c1 + c2 >= OpSizeInBits)
|
||||
return DAG.getConstant(0, VT);
|
||||
return DAG.getNode(ISD::SRL, N->getDebugLoc(), VT, N0.getOperand(0),
|
||||
DAG.getConstant(c1 + c2, N1.getValueType()));
|
||||
|
|
Loading…
Reference in New Issue