mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-14 23:48:49 +00:00
Simplify: truncate ({zero|sign}_extend (X))
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19353 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
03c0cf822e
commit
fd8c39b773
@ -428,6 +428,15 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
|
||||
if (Operand.getValueType() == VT) return Operand; // noop truncate
|
||||
if (OpOpcode == ISD::TRUNCATE)
|
||||
return getNode(ISD::TRUNCATE, VT, Operand.Val->getOperand(0));
|
||||
else if (OpOpcode == ISD::ZERO_EXTEND || OpOpcode == ISD::SIGN_EXTEND) {
|
||||
// If the source is smaller than the dest, we still need an extend.
|
||||
if (Operand.Val->getOperand(0).getValueType() < VT)
|
||||
return getNode(OpOpcode, VT, Operand.Val->getOperand(0));
|
||||
else if (Operand.Val->getOperand(0).getValueType() > VT)
|
||||
return getNode(ISD::TRUNCATE, VT, Operand.Val->getOperand(0));
|
||||
else
|
||||
return Operand.Val->getOperand(0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user