diff options
author | Duncan Sands <baldrick@free.fr> | 2008-12-13 22:33:38 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2008-12-13 22:33:38 +0000 |
commit | 0f546d4565b988f69850f42282e57a850153146d (patch) | |
tree | d669c6724eaf2b97974600e1d5e3271d08b57561 /lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | |
parent | 3f101bb1e74ff1be6e1a84425642e6adef2c75f0 (diff) |
LegalizeDAG is not supposed to introduce illegal
types into the DAG if they were not already there.
Check this with an assertion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60997 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 6f4158b58c..dd9d667895 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -51,6 +51,7 @@ namespace { class VISIBILITY_HIDDEN SelectionDAGLegalize { TargetLowering &TLI; SelectionDAG &DAG; + bool TypesNeedLegalizing; // Libcall insertion helpers. @@ -127,7 +128,7 @@ class VISIBILITY_HIDDEN SelectionDAGLegalize { } public: - explicit SelectionDAGLegalize(SelectionDAG &DAG); + explicit SelectionDAGLegalize(SelectionDAG &DAG, bool TypesNeedLegalizing); /// getTypeAction - Return how we should legalize values of this type, either /// it is already legal or we need to expand it into multiple registers of @@ -348,8 +349,8 @@ SDNode *SelectionDAGLegalize::isShuffleLegal(MVT VT, SDValue Mask) const { return TLI.isShuffleMaskLegal(Mask, VT) ? Mask.getNode() : 0; } -SelectionDAGLegalize::SelectionDAGLegalize(SelectionDAG &dag) - : TLI(dag.getTargetLoweringInfo()), DAG(dag), +SelectionDAGLegalize::SelectionDAGLegalize(SelectionDAG &dag, bool types) + : TLI(dag.getTargetLoweringInfo()), DAG(dag), TypesNeedLegalizing(types), ValueTypeActions(TLI.getValueTypeActions()) { assert(MVT::LAST_VALUETYPE <= 32 && "Too many value types for ValueTypeActions to hold!"); @@ -488,6 +489,8 @@ bool SelectionDAGLegalize::LegalizeAllNodesNotLeadingTo(SDNode *N, SDNode *Dest, /// appropriate for its type. void SelectionDAGLegalize::HandleOp(SDValue Op) { MVT VT = Op.getValueType(); + assert((TypesNeedLegalizing || getTypeAction(VT) == Legal) && + "Illegal type introduced after type legalization?"); switch (getTypeAction(VT)) { default: assert(0 && "Bad type action!"); case Legal: (void)LegalizeOp(Op); break; @@ -8602,9 +8605,9 @@ SDValue SelectionDAGLegalize::StoreWidenVectorOp(StoreSDNode *ST, // SelectionDAG::Legalize - This is the entry point for the file. // -void SelectionDAG::Legalize() { +void SelectionDAG::Legalize(bool TypesNeedLegalizing) { /// run - This is the main entry point to this class. /// - SelectionDAGLegalize(*this).LegalizeDAG(); + SelectionDAGLegalize(*this, TypesNeedLegalizing).LegalizeDAG(); } |