diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-07-08 20:06:39 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-07-08 20:06:39 +0000 |
commit | 71e8685633e7938ee752004cceedccbd0d850527 (patch) | |
tree | f959df8f022930987c57694dbbc7d10c57e2cacd /lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | |
parent | 7ba11c552b8a25ad1272b44d96e886a784dae0b7 (diff) | |
download | external_llvm-71e8685633e7938ee752004cceedccbd0d850527.zip external_llvm-71e8685633e7938ee752004cceedccbd0d850527.tar.gz external_llvm-71e8685633e7938ee752004cceedccbd0d850527.tar.bz2 |
Do not CSE DEBUG_LOC, DBG_LABEL, DBG_STOPPOINT, DECLARE, and EH_LABEL SDNode's. This improves compile time slightly at -O0 -g.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53246 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 62 |
1 files changed, 36 insertions, 26 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index a3f268f..eddce0f 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -1094,12 +1094,10 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { unsigned Col = DSP->getColumn(); if (useDEBUG_LOC) { - SmallVector<SDOperand, 8> Ops; - Ops.push_back(Tmp1); // chain - Ops.push_back(DAG.getConstant(Line, MVT::i32)); // line # - Ops.push_back(DAG.getConstant(Col, MVT::i32)); // col # - Ops.push_back(DAG.getConstant(SrcFile, MVT::i32)); // source file id - Result = DAG.getNode(ISD::DEBUG_LOC, MVT::Other, &Ops[0], Ops.size()); + SDOperand Ops[] = { Tmp1, DAG.getConstant(Line, MVT::i32), + DAG.getConstant(Col, MVT::i32), + DAG.getConstant(SrcFile, MVT::i32) }; + Result = DAG.getNode(ISD::DEBUG_LOC, MVT::Other, Ops, 4); } else { unsigned ID = MMI->RecordSourceLine(Line, Col, SrcFile); Result = DAG.getLabel(ISD::DBG_LABEL, Tmp1, ID); @@ -1109,25 +1107,27 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { } break; } - case TargetLowering::Legal: - if (Tmp1 != Node->getOperand(0) || - getTypeAction(Node->getOperand(1).getValueType()) == Promote) { - SmallVector<SDOperand, 8> Ops; - Ops.push_back(Tmp1); - if (getTypeAction(Node->getOperand(1).getValueType()) == Legal) { - Ops.push_back(Node->getOperand(1)); // line # must be legal. - Ops.push_back(Node->getOperand(2)); // col # must be legal. - } else { - // Otherwise promote them. - Ops.push_back(PromoteOp(Node->getOperand(1))); - Ops.push_back(PromoteOp(Node->getOperand(2))); - } - Ops.push_back(Node->getOperand(3)); // filename must be legal. - Ops.push_back(Node->getOperand(4)); // working dir # must be legal. - Result = DAG.UpdateNodeOperands(Result, &Ops[0], Ops.size()); + case TargetLowering::Legal: { + LegalizeAction Action = getTypeAction(Node->getOperand(1).getValueType()); + if (Action == Legal && Tmp1 == Node->getOperand(0)) + break; + + SmallVector<SDOperand, 8> Ops; + Ops.push_back(Tmp1); + if (Action == Legal) { + Ops.push_back(Node->getOperand(1)); // line # must be legal. + Ops.push_back(Node->getOperand(2)); // col # must be legal. + } else { + // Otherwise promote them. + Ops.push_back(PromoteOp(Node->getOperand(1))); + Ops.push_back(PromoteOp(Node->getOperand(2))); } + Ops.push_back(Node->getOperand(3)); // filename must be legal. + Ops.push_back(Node->getOperand(4)); // working dir # must be legal. + Result = DAG.UpdateNodeOperands(Result, &Ops[0], Ops.size()); break; } + } break; case ISD::DECLARE: @@ -1150,14 +1150,24 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { assert(Node->getNumOperands() == 4 && "Invalid DEBUG_LOC node!"); switch (TLI.getOperationAction(ISD::DEBUG_LOC, MVT::Other)) { default: assert(0 && "This action is not supported yet!"); - case TargetLowering::Legal: + case TargetLowering::Legal: { + LegalizeAction Action = getTypeAction(Node->getOperand(1).getValueType()); Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. - Tmp2 = LegalizeOp(Node->getOperand(1)); // Legalize the line #. - Tmp3 = LegalizeOp(Node->getOperand(2)); // Legalize the col #. - Tmp4 = LegalizeOp(Node->getOperand(3)); // Legalize the source file id. + if (Action == Legal && Tmp1 == Node->getOperand(0)) + break; + if (Action == Legal) { + Tmp2 = Node->getOperand(1); + Tmp3 = Node->getOperand(2); + Tmp4 = Node->getOperand(3); + } else { + Tmp2 = LegalizeOp(Node->getOperand(1)); // Legalize the line #. + Tmp3 = LegalizeOp(Node->getOperand(2)); // Legalize the col #. + Tmp4 = LegalizeOp(Node->getOperand(3)); // Legalize the source file id. + } Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2, Tmp3, Tmp4); break; } + } break; case ISD::DBG_LABEL: |