summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2013-06-03 17:39:50 +0000
committerTom Stellard <thomas.stellard@amd.com>2013-06-03 17:39:50 +0000
commit051a28e0e8a5a6f41d9360a58079af6231557152 (patch)
treebda494f6b261bede1550c797b061f970f17022fa /lib
parent8a72c73032707c7b3c042b716286a1ac33720991 (diff)
downloadllvm-051a28e0e8a5a6f41d9360a58079af6231557152.tar.gz
llvm-051a28e0e8a5a6f41d9360a58079af6231557152.tar.bz2
llvm-051a28e0e8a5a6f41d9360a58079af6231557152.tar.xz
R600/SI: Handle nodes with glue results correctly SITargetLowering::foldOperands()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183133 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/R600/SIISelLowering.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Target/R600/SIISelLowering.cpp b/lib/Target/R600/SIISelLowering.cpp
index 826ed9acd3..d2cf0dcf20 100644
--- a/lib/Target/R600/SIISelLowering.cpp
+++ b/lib/Target/R600/SIISelLowering.cpp
@@ -700,6 +700,22 @@ SDNode *SITargetLowering::foldOperands(MachineSDNode *Node,
for (unsigned i = NumOps - NumDefs, e = Node->getNumOperands(); i < e; ++i)
Ops.push_back(Node->getOperand(i));
+ // 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;
+ }
+ }
+
// Create a complete new instruction
return DAG.getMachineNode(Desc->Opcode, SDLoc(Node), Node->getVTList(), Ops);
}