[PATCH] D41083: DAG: Tolerate non-MemSDNOdes for OPC_RecordMemRef
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 18 08:57:31 PST 2017
arsenm updated this revision to Diff 127373.
arsenm added a comment.
Add some debug printing
https://reviews.llvm.org/D41083
Files:
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -3117,7 +3117,16 @@
continue;
}
case OPC_RecordMemRef:
- MatchedMemRefs.push_back(cast<MemSDNode>(N)->getMemOperand());
+ if (auto *MN = dyn_cast<MemSDNode>(N))
+ MatchedMemRefs.push_back(MN->getMemOperand());
+ else {
+ DEBUG(
+ dbgs() << "Expected MemSDNode ";
+ N->dump(CurDAG);
+ dbgs() << '\n'
+ );
+ }
+
continue;
case OPC_CaptureGlueInput:
@@ -3563,7 +3572,7 @@
Ops.push_back(InputGlue);
// Create the node.
- SDNode *Res = nullptr;
+ MachineSDNode *Res = nullptr;
bool IsMorphNodeTo = Opcode == OPC_MorphNodeTo ||
(Opcode >= OPC_MorphNodeTo0 && Opcode <= OPC_MorphNodeTo2);
if (!IsMorphNodeTo) {
@@ -3589,7 +3598,8 @@
"Chain node replaced during MorphNode");
Chain.erase(std::remove(Chain.begin(), Chain.end(), N), Chain.end());
});
- Res = MorphNode(NodeToMatch, TargetOpc, VTList, Ops, EmitNodeInfo);
+ Res = cast<MachineSDNode>(MorphNode(NodeToMatch, TargetOpc, VTList,
+ Ops, EmitNodeInfo));
}
// If the node had chain/glue results, update our notion of the current
@@ -3645,13 +3655,19 @@
}
}
- cast<MachineSDNode>(Res)
- ->setMemRefs(MemRefs, MemRefs + NumMemRefs);
+ //Res->setMemRefs(MemRefs, MemRefs + NumMemRefs);
}
- DEBUG(dbgs() << " "
- << (IsMorphNodeTo ? "Morphed" : "Created")
- << " node: "; Res->dump(CurDAG); dbgs() << "\n");
+ DEBUG(
+ if (!MatchedMemRefs.empty() && Res->memoperands_empty())
+ dbgs() << " Dropping mem operands\n";
+ dbgs() << " "
+ << (IsMorphNodeTo ? "Morphed" : "Created")
+ << " node: ";
+ Res->dump(CurDAG);
+
+ dbgs() << '\n';
+ );
// If this was a MorphNodeTo then we're completely done!
if (IsMorphNodeTo) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41083.127373.patch
Type: text/x-patch
Size: 2249 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171218/a391ac7b/attachment.bin>
More information about the llvm-commits
mailing list