mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-14 17:34:41 +00:00
Shift by the word size is invalid IR; don't create it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122353 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
90b0364cff
commit
efc96dd38c
@ -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…
x
Reference in New Issue
Block a user