diff options
| author | Tom Stellard <thomas.stellard@amd.com> | 2013-06-05 23:39:50 +0000 |
|---|---|---|
| committer | Tom Stellard <thomas.stellard@amd.com> | 2013-06-05 23:39:50 +0000 |
| commit | acec99c948b8f85f0185797b90d06e4a03fea1fd (patch) | |
| tree | 257531d77632710f1f1ac23f8b312959b12e8d3f /llvm/lib/Target/R600 | |
| parent | b7e82adb7203514d97fa12f4f7b4c620ae433d95 (diff) | |
| download | bcm5719-llvm-acec99c948b8f85f0185797b90d06e4a03fea1fd.tar.gz bcm5719-llvm-acec99c948b8f85f0185797b90d06e4a03fea1fd.zip | |
R600: Replace predicate loop with predicate function
llvm-svn: 183351
Diffstat (limited to 'llvm/lib/Target/R600')
| -rw-r--r-- | llvm/lib/Target/R600/SIISelLowering.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/llvm/lib/Target/R600/SIISelLowering.cpp b/llvm/lib/Target/R600/SIISelLowering.cpp index 5dca0ca00c8..ac6a4c32a7f 100644 --- a/llvm/lib/Target/R600/SIISelLowering.cpp +++ b/llvm/lib/Target/R600/SIISelLowering.cpp @@ -680,6 +680,17 @@ void SITargetLowering::ensureSRegLimit(SelectionDAG &DAG, SDValue &Operand, 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 SDNode *SITargetLowering::foldOperands(MachineSDNode *Node, 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 // 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. - if (Desc->Opcode == Opcode) { - bool Changed = false; - 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; - } + if (Desc->Opcode == Opcode && !isNodeChanged(Node, Ops)) { + return Node; } // Create a complete new instruction |

