mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-03 13:31:05 +00:00
Fix PR1011 and CodeGen/Generic/2006-11-20-DAGCombineCrash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31878 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f2d2a5a79c
commit
32ba1aa204
@ -2180,10 +2180,10 @@ SDOperand DAGCombiner::visitTRUNCATE(SDNode *N) {
|
|||||||
// fold (truncate (ext x)) -> (ext x) or (truncate x) or x
|
// fold (truncate (ext x)) -> (ext x) or (truncate x) or x
|
||||||
if (N0.getOpcode() == ISD::ZERO_EXTEND || N0.getOpcode() == ISD::SIGN_EXTEND||
|
if (N0.getOpcode() == ISD::ZERO_EXTEND || N0.getOpcode() == ISD::SIGN_EXTEND||
|
||||||
N0.getOpcode() == ISD::ANY_EXTEND) {
|
N0.getOpcode() == ISD::ANY_EXTEND) {
|
||||||
if (N0.getValueType() < VT)
|
if (N0.getOperand(0).getValueType() < VT)
|
||||||
// if the source is smaller than the dest, we still need an extend
|
// if the source is smaller than the dest, we still need an extend
|
||||||
return DAG.getNode(N0.getOpcode(), VT, N0.getOperand(0));
|
return DAG.getNode(N0.getOpcode(), VT, N0.getOperand(0));
|
||||||
else if (N0.getValueType() > VT)
|
else if (N0.getOperand(0).getValueType() > VT)
|
||||||
// if the source is larger than the dest, than we just need the truncate
|
// if the source is larger than the dest, than we just need the truncate
|
||||||
return DAG.getNode(ISD::TRUNCATE, VT, N0.getOperand(0));
|
return DAG.getNode(ISD::TRUNCATE, VT, N0.getOperand(0));
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user