forked from OSchip/llvm-project
R600: Replace predicate loop with predicate function
llvm-svn: 183351
This commit is contained in:
parent
b7e82adb72
commit
acec99c948
|
@ -680,6 +680,17 @@ void SITargetLowering::ensureSRegLimit(SelectionDAG &DAG, SDValue &Operand,
|
||||||
Operand = SDValue(Node, 0);
|
Operand = SDValue(Node, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// \returns true if \p Node's operands are different from the SDValue list
|
||||||
|
/// \p Ops
|
||||||
|
static bool isNodeChanged(const SDNode *Node, const std::vector<SDValue> &Ops) {
|
||||||
|
for (unsigned i = 0, e = Node->getNumOperands(); i < e; ++i) {
|
||||||
|
if (Ops[i].getNode() != Node->getOperand(i).getNode()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// \brief Try to fold the Nodes operands into the Node
|
/// \brief Try to fold the Nodes operands into the Node
|
||||||
SDNode *SITargetLowering::foldOperands(MachineSDNode *Node,
|
SDNode *SITargetLowering::foldOperands(MachineSDNode *Node,
|
||||||
SelectionDAG &DAG) const {
|
SelectionDAG &DAG) const {
|
||||||
|
@ -814,17 +825,8 @@ SDNode *SITargetLowering::foldOperands(MachineSDNode *Node,
|
||||||
// Nodes that have a glue result are not CSE'd by getMachineNode(), so in
|
// Nodes that have a glue result are not CSE'd by getMachineNode(), so in
|
||||||
// this case a brand new node is always be created, even if the operands
|
// this case a brand new node is always be created, even if the operands
|
||||||
// are the same as before. So, manually check if anything has been changed.
|
// are the same as before. So, manually check if anything has been changed.
|
||||||
if (Desc->Opcode == Opcode) {
|
if (Desc->Opcode == Opcode && !isNodeChanged(Node, Ops)) {
|
||||||
bool Changed = false;
|
return Node;
|
||||||
for (unsigned i = 0, e = Node->getNumOperands(); i < e; ++i) {
|
|
||||||
if (Ops[i].getNode() != Node->getOperand(i).getNode()) {
|
|
||||||
Changed = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!Changed) {
|
|
||||||
return Node;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a complete new instruction
|
// Create a complete new instruction
|
||||||
|
|
Loading…
Reference in New Issue