[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp 
    Evan Cheng 
    evan.cheng at apple.com
       
    Thu Jan  5 17:06:43 PST 2006
    
    
  
Changes in directory llvm/lib/CodeGen/SelectionDAG:
DAGCombiner.cpp updated: 1.77 -> 1.78
---
Log message:
fold (shl x, 1) -> (add x, x)
---
Diffs of the changes:  (+3 -0)
 DAGCombiner.cpp |    3 +++
 1 files changed, 3 insertions(+)
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.77 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.78
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.77	Wed Jan  4 19:25:28 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Thu Jan  5 19:06:31 2006
@@ -1282,6 +1282,9 @@
   // fold (shl x, 0) -> x
   if (N1C && N1C->isNullValue())
     return N0;
+  // fold (shl x, 1) -> (add x, x)
+  if (N1C && N1C->getValue() == 1)
+    return DAG.getNode(ISD::ADD, VT, N0, N0);
   // if (shl x, c) is known to be zero, return 0
   if (N1C && MaskedValueIsZero(SDOperand(N, 0), ~0ULL >> (64-OpSizeInBits),TLI))
     return DAG.getConstant(0, VT);
    
    
More information about the llvm-commits
mailing list