aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-02-25 08:24:27 +0000
committerChris Lattner <sabre@nondot.org>2007-02-25 08:24:27 +0000
commit753d9cb50e1d2e78b9a82185dc64f0e672560775 (patch)
treeb4aced248476bd38ea531fd0edf53d4d3470005e /lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parentf4acec1be88c339366c0d8cdc32e57f1b8d0a81a (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34584 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 23a66f5562..2679a8ccd8 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -1351,6 +1351,12 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,
// 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.