mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 00:24:26 +00:00
Fix a bug in the folding of binary operators to undef.
Thanks to Lauro for spotting this! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38491 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -855,7 +855,9 @@ SDOperand DAGCombiner::visitADD(SDNode *N) {
|
|||||||
if (FoldedVOp.Val) return FoldedVOp;
|
if (FoldedVOp.Val) return FoldedVOp;
|
||||||
|
|
||||||
// fold (add x, undef) -> undef
|
// fold (add x, undef) -> undef
|
||||||
if (N0.getOpcode() == ISD::UNDEF || N1.getOpcode() == ISD::UNDEF)
|
if (N0.getOpcode() == ISD::UNDEF)
|
||||||
|
return N0;
|
||||||
|
if (N1.getOpcode() == ISD::UNDEF)
|
||||||
return N1;
|
return N1;
|
||||||
// fold (add c1, c2) -> c1+c2
|
// fold (add c1, c2) -> c1+c2
|
||||||
if (N0C && N1C)
|
if (N0C && N1C)
|
||||||
@ -1029,8 +1031,10 @@ SDOperand DAGCombiner::visitSUB(SDNode *N) {
|
|||||||
if (Result.Val) return Result;
|
if (Result.Val) return Result;
|
||||||
}
|
}
|
||||||
// If either operand of a sub is undef, the result is undef
|
// If either operand of a sub is undef, the result is undef
|
||||||
if (N0.getOpcode() == ISD::UNDEF || N1.getOpcode() == ISD::UNDEF)
|
if (N0.getOpcode() == ISD::UNDEF)
|
||||||
return DAG.getNode(ISD::UNDEF, VT);
|
return N0;
|
||||||
|
if (N1.getOpcode() == ISD::UNDEF)
|
||||||
|
return N1;
|
||||||
|
|
||||||
return SDOperand();
|
return SDOperand();
|
||||||
}
|
}
|
||||||
@ -1890,7 +1894,9 @@ SDOperand DAGCombiner::visitXOR(SDNode *N) {
|
|||||||
if (FoldedVOp.Val) return FoldedVOp;
|
if (FoldedVOp.Val) return FoldedVOp;
|
||||||
|
|
||||||
// fold (xor x, undef) -> undef
|
// fold (xor x, undef) -> undef
|
||||||
if (N0.getOpcode() == ISD::UNDEF || N1.getOpcode() == ISD::UNDEF)
|
if (N0.getOpcode() == ISD::UNDEF)
|
||||||
|
return N0;
|
||||||
|
if (N1.getOpcode() == ISD::UNDEF)
|
||||||
return N1;
|
return N1;
|
||||||
// fold (xor c1, c2) -> c1^c2
|
// fold (xor c1, c2) -> c1^c2
|
||||||
if (N0C && N1C)
|
if (N0C && N1C)
|
||||||
|
Reference in New Issue
Block a user