summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2010-06-23 18:16:24 +0000
committerBill Wendling <isanbard@gmail.com>2010-06-23 18:16:24 +0000
commita136521a173c83b0ddace0fb01c083a76f7ca218 (patch)
tree528ca1add1a3e50110172d533cc7e6ba5d0d2436 /llvm/lib
parenta99a3c108f00e8c8d6273c32a5a96b9f939bc6b5 (diff)
downloadbcm5719-llvm-a136521a173c83b0ddace0fb01c083a76f7ca218.tar.gz
bcm5719-llvm-a136521a173c83b0ddace0fb01c083a76f7ca218.zip
MorphNodeTo doesn't preserve the memory operands. Because we're morphing a node
into the same node, but with different non-memory operands, we need to replace the memory operands after it's finished morphing. llvm-svn: 106643
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
index 090f0a57d52..07277b3f349 100644
--- a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
@@ -110,17 +110,35 @@ static void CheckForPhysRegDependency(SDNode *Def, SDNode *User, unsigned Op,
static void AddFlags(SDNode *N, SDValue Flag, bool AddFlag,
SelectionDAG *DAG) {
SmallVector<EVT, 4> VTs;
+
for (unsigned i = 0, e = N->getNumValues(); i != e; ++i)
VTs.push_back(N->getValueType(i));
+
if (AddFlag)
VTs.push_back(MVT::Flag);
+
SmallVector<SDValue, 4> Ops;
for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i)
Ops.push_back(N->getOperand(i));
+
if (Flag.getNode())
Ops.push_back(Flag);
+
SDVTList VTList = DAG->getVTList(&VTs[0], VTs.size());
+ MachineSDNode::mmo_iterator Begin = 0, End = 0;
+ MachineSDNode *MN = dyn_cast<MachineSDNode>(N);
+
+ // Store memory references.
+ if (MN) {
+ Begin = MN->memoperands_begin();
+ End = MN->memoperands_end();
+ }
+
DAG->MorphNodeTo(N, N->getOpcode(), VTList, &Ops[0], Ops.size());
+
+ // Reset the memory references
+ if (MN)
+ MN->setMemRefs(Begin, End);
}
/// ClusterNeighboringLoads - Force nearby loads together by "flagging" them.
@@ -196,13 +214,16 @@ void ScheduleDAGSDNodes::ClusterNeighboringLoads(SDNode *Node) {
// ensure they are scheduled in order of increasing addresses.
SDNode *Lead = Loads[0];
AddFlags(Lead, SDValue(0,0), true, DAG);
+
SDValue InFlag = SDValue(Lead, Lead->getNumValues()-1);
for (unsigned i = 1, e = Loads.size(); i != e; ++i) {
bool OutFlag = i < e-1;
SDNode *Load = Loads[i];
AddFlags(Load, InFlag, OutFlag, DAG);
+
if (OutFlag)
InFlag = SDValue(Load, Load->getNumValues()-1);
+
++LoadsClustered;
}
}
OpenPOWER on IntegriCloud