[llvm] r183351 - R600: Replace predicate loop with predicate function
Tom Stellard
thomas.stellard at amd.com
Wed Jun 5 16:39:50 PDT 2013
Author: tstellar
Date: Wed Jun 5 18:39:50 2013
New Revision: 183351
URL: http://llvm.org/viewvc/llvm-project?rev=183351&view=rev
Log:
R600: Replace predicate loop with predicate function
Modified:
llvm/trunk/lib/Target/R600/SIISelLowering.cpp
Modified: llvm/trunk/lib/Target/R600/SIISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/SIISelLowering.cpp?rev=183351&r1=183350&r2=183351&view=diff
==============================================================================
--- llvm/trunk/lib/Target/R600/SIISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/R600/SIISelLowering.cpp Wed Jun 5 18:39:50 2013
@@ -680,6 +680,17 @@ void SITargetLowering::ensureSRegLimit(S
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(M
// 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
More information about the llvm-commits
mailing list