aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/LegalizeTypes.h
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2008-10-29 06:42:19 +0000
committerDuncan Sands <baldrick@free.fr>2008-10-29 06:42:19 +0000
commit23b10f5b64e594aa7c6b415805b563fed2a75874 (patch)
treeac2eb9290783cc8dade0d031612e8c568ad79562 /lib/CodeGen/SelectionDAG/LegalizeTypes.h
parentb3bc6352defdf1a5c6b1b0770d0c4d603f6524a8 (diff)
Fix a FIXME: in ReplaceNodeWith, if the new node
is morphed by AnalyzeNewNode into a previously processed node, and different result values of that node are remapped to values with different nodes, then we could end up using wrong values here [we were assuming that all results remap to values with the same underlying node]. This seems theoretically possible, but I don't have a testcase. The meat of the patch is in the changes to AnalyzeNewNode/AnalyzeNewValue and ReplaceNodeWith. While there, I changed names like RemapNode to RemapValue, since it really remaps values. To tell the truth, I would be much happier if we were only remapping nodes (it would simplify a bunch of logic, and allow for some cute speedups) but I haven't yet worked out how to do that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58372 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeTypes.h')
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeTypes.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypes.h b/lib/CodeGen/SelectionDAG/LegalizeTypes.h
index 19aa2c6682..da358d4660 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeTypes.h
+++ b/lib/CodeGen/SelectionDAG/LegalizeTypes.h
@@ -134,9 +134,9 @@ private:
/// which operands are the expanded version of the input.
DenseMap<SDValue, std::pair<SDValue, SDValue> > SplitVectors;
- /// ReplacedNodes - For nodes that have been replaced with another,
- /// indicates the replacement node to use.
- DenseMap<SDValue, SDValue> ReplacedNodes;
+ /// ReplacedValues - For values that have been replaced with another,
+ /// indicates the replacement value to use.
+ DenseMap<SDValue, SDValue> ReplacedValues;
/// Worklist - This defines a worklist of nodes to process. In order to be
/// pushed onto this worklist, all operands of a node must have already been
@@ -157,8 +157,7 @@ public:
/// for the specified node, adding it to the worklist if ready.
void ReanalyzeNode(SDNode *N) {
N->setNodeId(NewNode);
- SDValue Val(N, 0);
- AnalyzeNewNode(Val);
+ AnalyzeNewNode(N);
// The node may have changed but we don't care.
}
@@ -166,16 +165,17 @@ public:
ExpungeNode(Old);
ExpungeNode(New);
for (unsigned i = 0, e = Old->getNumValues(); i != e; ++i)
- ReplacedNodes[SDValue(Old, i)] = SDValue(New, i);
+ ReplacedValues[SDValue(Old, i)] = SDValue(New, i);
}
private:
- void AnalyzeNewNode(SDValue &Val);
+ SDNode *AnalyzeNewNode(SDNode *N);
+ void AnalyzeNewValue(SDValue &Val);
void ReplaceValueWith(SDValue From, SDValue To);
void ReplaceNodeWith(SDNode *From, SDNode *To);
- void RemapNode(SDValue &N);
+ void RemapValue(SDValue &N);
void ExpungeNode(SDNode *N);
// Common routines.
@@ -197,7 +197,7 @@ private:
SDValue GetPromotedInteger(SDValue Op) {
SDValue &PromotedOp = PromotedIntegers[Op];
- RemapNode(PromotedOp);
+ RemapValue(PromotedOp);
assert(PromotedOp.getNode() && "Operand wasn't promoted?");
return PromotedOp;
}
@@ -326,7 +326,7 @@ private:
SDValue GetSoftenedFloat(SDValue Op) {
SDValue &SoftenedOp = SoftenedFloats[Op];
- RemapNode(SoftenedOp);
+ RemapValue(SoftenedOp);
assert(SoftenedOp.getNode() && "Operand wasn't converted to integer?");
return SoftenedOp;
}
@@ -406,7 +406,7 @@ private:
SDValue GetScalarizedVector(SDValue Op) {
SDValue &ScalarizedOp = ScalarizedVectors[Op];
- RemapNode(ScalarizedOp);
+ RemapValue(ScalarizedOp);
assert(ScalarizedOp.getNode() && "Operand wasn't scalarized?");
return ScalarizedOp;
}