mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-19 19:29:31 +00:00
When we legalize target nodes, do not use getNode to create a new node,
use UpdateNodeOperands to just update the operands! This is important because getNode will allocate a new node if the node returns a flag and this breaks assumptions in the legalizer that you can legalize some things multiple times and get exactly the same results. This latent bug was exposed by my ppc patch last night, and this fixes gsm/toast. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28348 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b248e16afd
commit
c5d7d7c715
@ -529,19 +529,10 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
|
|||||||
// If this is a target node, legalize it by legalizing the operands then
|
// If this is a target node, legalize it by legalizing the operands then
|
||||||
// passing it through.
|
// passing it through.
|
||||||
std::vector<SDOperand> Ops;
|
std::vector<SDOperand> Ops;
|
||||||
bool Changed = false;
|
for (unsigned i = 0, e = Node->getNumOperands(); i != e; ++i)
|
||||||
for (unsigned i = 0, e = Node->getNumOperands(); i != e; ++i) {
|
|
||||||
Ops.push_back(LegalizeOp(Node->getOperand(i)));
|
Ops.push_back(LegalizeOp(Node->getOperand(i)));
|
||||||
Changed = Changed || Node->getOperand(i) != Ops.back();
|
|
||||||
}
|
Result = DAG.UpdateNodeOperands(Result.getValue(0), Ops);
|
||||||
if (Changed)
|
|
||||||
if (Node->getNumValues() == 1)
|
|
||||||
Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Ops);
|
|
||||||
else {
|
|
||||||
std::vector<MVT::ValueType> VTs(Node->value_begin(),
|
|
||||||
Node->value_end());
|
|
||||||
Result = DAG.getNode(Node->getOpcode(), VTs, Ops);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (unsigned i = 0, e = Node->getNumValues(); i != e; ++i)
|
for (unsigned i = 0, e = Node->getNumValues(); i != e; ++i)
|
||||||
AddLegalizedOperand(Op.getValue(i), Result.getValue(i));
|
AddLegalizedOperand(Op.getValue(i), Result.getValue(i));
|
||||||
@ -1058,7 +1049,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
|
|||||||
|
|
||||||
// Merge in the last call, to ensure that this call start after the last
|
// Merge in the last call, to ensure that this call start after the last
|
||||||
// call ended.
|
// call ended.
|
||||||
if (LastCALLSEQ_END.getOpcode() != ISD::EntryNode) {
|
if (LastCALLSEQ_END.getOpcode() != ISD::EntryToken) {
|
||||||
Tmp1 = DAG.getNode(ISD::TokenFactor, MVT::Other, Tmp1, LastCALLSEQ_END);
|
Tmp1 = DAG.getNode(ISD::TokenFactor, MVT::Other, Tmp1, LastCALLSEQ_END);
|
||||||
Tmp1 = LegalizeOp(Tmp1);
|
Tmp1 = LegalizeOp(Tmp1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user