[llvm-commits] [llvm] r50434 - /llvm/branches/Apple/Tak/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Evan Cheng evan.cheng at apple.com
Tue Apr 29 11:29:14 PDT 2008


Author: evancheng
Date: Tue Apr 29 13:29:14 2008
New Revision: 50434

URL: http://llvm.org/viewvc/llvm-project?rev=50434&view=rev
Log:
Ported 50376 to Tak.

Modified:
    llvm/branches/Apple/Tak/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Modified: llvm/branches/Apple/Tak/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Tak/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=50434&r1=50433&r2=50434&view=diff

==============================================================================
--- llvm/branches/Apple/Tak/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/branches/Apple/Tak/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Apr 29 13:29:14 2008
@@ -3442,7 +3442,20 @@
     if (Flag)
       *Flag = Part.getValue(1);
   }
-  Chain = DAG.getNode(ISD::TokenFactor, MVT::Other, &Chains[0], NumRegs);
+  if (NumRegs == 1 || Flag)
+    // If NumRegs > 1 && Flag is used then the use of the last CopyToReg is 
+    // flagged to it. That is the CopyToReg nodes and the user are considered
+    // a single scheduling unit. If we create a TokenFactor and return it as
+    // chain, then the TokenFactor is both a predecessor (operand) of the
+    // user as well as a successor (the TF operands are flagged to the user).
+    // c1, f1 = CopyToReg
+    // c2, f2 = CopyToReg
+    // c3     = TokenFactor c1, c2
+    // ...
+    //        = op c3, ..., f2
+    Chain = Chains[NumRegs-1];
+  else
+    Chain = DAG.getNode(ISD::TokenFactor, MVT::Other, &Chains[0], NumRegs);
 }
 
 /// AddInlineAsmOperands - Add this value to the specified inlineasm node





More information about the llvm-commits mailing list