[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed May 17 10:56:11 PDT 2006
Changes in directory llvm/lib/CodeGen/SelectionDAG:
LegalizeDAG.cpp updated: 1.375 -> 1.376
---
Log message:
Add an assertion, avoid some unneeded work for each call. No functionality
change.
---
Diffs of the changes: (+10 -6)
LegalizeDAG.cpp | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.375 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.376
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.375 Tue May 16 17:53:20 2006
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed May 17 12:55:45 2006
@@ -820,13 +820,15 @@
case ISD::FORMAL_ARGUMENTS:
case ISD::CALL:
// The only option for this is to custom lower it.
- Result = TLI.LowerOperation(Result.getValue(0), DAG);
- assert(Result.Val && "Target didn't custom lower this node!");
+ Tmp3 = TLI.LowerOperation(Result.getValue(0), DAG);
+ assert(Tmp3.Val && "Target didn't custom lower this node!");
+ assert(Tmp3.Val->getNumValues() == Result.Val->getNumValues() &&
+ "Lowering call/formal_arguments produced unexpected # results!");
// Since CALL/FORMAL_ARGUMENTS nodes produce multiple values, make sure to
// remember that we legalized all of them, so it doesn't get relegalized.
- for (unsigned i = 0, e = Result.Val->getNumValues(); i != e; ++i) {
- Tmp1 = LegalizeOp(Result.getValue(i));
+ for (unsigned i = 0, e = Tmp3.Val->getNumValues(); i != e; ++i) {
+ Tmp1 = LegalizeOp(Tmp3.getValue(i));
if (Op.ResNo == i)
Tmp2 = Tmp1;
AddLegalizedOperand(SDOperand(Node, i), Tmp1);
@@ -1056,8 +1058,10 @@
// Merge in the last call, to ensure that this call start after the last
// call ended.
- Tmp1 = DAG.getNode(ISD::TokenFactor, MVT::Other, Tmp1, LastCALLSEQ_END);
- Tmp1 = LegalizeOp(Tmp1);
+ if (LastCALLSEQ_END.getOpcode() != ISD::EntryNode) {
+ Tmp1 = DAG.getNode(ISD::TokenFactor, MVT::Other, Tmp1, LastCALLSEQ_END);
+ Tmp1 = LegalizeOp(Tmp1);
+ }
// Do not try to legalize the target-specific arguments (#1+).
if (Tmp1 != Node->getOperand(0)) {
More information about the llvm-commits
mailing list