[llvm-commits] [llvm] r50357 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Dan Gohman gohman at apple.com
Mon Apr 28 09:58:24 PDT 2008


Author: djg
Date: Mon Apr 28 11:58:24 2008
New Revision: 50357

URL: http://llvm.org/viewvc/llvm-project?rev=50357&view=rev
Log:
Teach DAGCombine to convert (sext x) to (zext x) when the
sign-bit of x is known to be zero.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=50357&r1=50356&r2=50357&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Apr 28 11:58:24 2008
@@ -2887,6 +2887,10 @@
     if (SCC.Val) return SCC;
   }
   
+  // fold (sext x) -> (zext x) if the sign bit is known zero.
+  if (DAG.SignBitIsZero(N0))
+    return DAG.getNode(ISD::ZERO_EXTEND, VT, N0);
+  
   return SDOperand();
 }
 





More information about the llvm-commits mailing list