[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Chris Lattner sabre at nondot.org
Sun Feb 25 00:24:44 PST 2007



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAG.cpp updated: 1.390 -> 1.391
---
Log message:

fold trivial token factor nodes.  This allows us to compile 
test/CodeGen/X86/fp-stack-ret.ll into:

        movl 4(%esp), %eax
        fldl (%eax)
        ret

instead of:

        subl $12, %esp
        movl 16(%esp), %eax
        movsd (%eax), %xmm0
        movsd %xmm0, (%esp)
        fldl (%esp)
        addl $12, %esp
        ret

by eliminating a token factor that blocked a check.



---
Diffs of the changes:  (+6 -0)

 SelectionDAG.cpp |    6 ++++++
 1 files changed, 6 insertions(+)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.390 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.391
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.390	Wed Feb 21 16:53:45 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp	Sun Feb 25 02:24:27 2007
@@ -1351,6 +1351,12 @@
 
   // Fold operations.
   switch (Opcode) {
+  case ISD::TokenFactor:
+    // Fold trivial token factors.
+    if (N1.getOpcode() == ISD::EntryToken) return N2;
+    if (N2.getOpcode() == ISD::EntryToken) return N1;
+    break;
+      
   case ISD::AND:
     // (X & 0) -> 0.  This commonly occurs when legalizing i64 values, so it's
     // worth handling here.






More information about the llvm-commits mailing list