aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2013-06-05 23:39:50 +0000
committerTom Stellard <thomas.stellard@amd.com>2013-06-05 23:39:50 +0000
commitc170230b3a8c1e0a43614a929061ad24888bfe52 (patch)
treef2dbae9a6dcbe35e6b12c84fa8c7da8a68e609c4
parent6acc982e74cd8a10d097c10254d7215028e7f036 (diff)
downloadexternal_llvm-c170230b3a8c1e0a43614a929061ad24888bfe52.zip
external_llvm-c170230b3a8c1e0a43614a929061ad24888bfe52.tar.gz
external_llvm-c170230b3a8c1e0a43614a929061ad24888bfe52.tar.bz2
R600: Replace predicate loop with predicate function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183351 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/R600/SIISelLowering.cpp24
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/Target/R600/SIISelLowering.cpp b/lib/Target/R600/SIISelLowering.cpp
index 5dca0ca..ac6a4c3 100644
--- a/lib/Target/R600/SIISelLowering.cpp
+++ b/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