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

Eric Christopher echristo at apple.com
Wed Nov 3 13:44:42 PDT 2010


Author: echristo
Date: Wed Nov  3 15:44:42 2010
New Revision: 118195

URL: http://llvm.org/viewvc/llvm-project?rev=118195&view=rev
Log:
Just return undef for invalid masks or elts, and since we're doing that,
just do it earlier too.

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=118195&r1=118194&r2=118195&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Nov  3 15:44:42 2010
@@ -6242,6 +6242,10 @@
     if (!LN0 || !LN0->hasOneUse() || LN0->isVolatile())
       return SDValue();
 
+    // If Idx was -1 above, Elt is going to be -1, so just return undef.
+    if (Elt == -1)
+      return DAG.getUNDEF(LN0->getBasePtr().getValueType());
+
     unsigned Align = LN0->getAlignment();
     if (NewLoad) {
       // Check the resultant load doesn't need a higher alignment than the
@@ -6257,11 +6261,8 @@
 
     SDValue NewPtr = LN0->getBasePtr();
     unsigned PtrOff = 0;
-    // If Idx was -1 above, Elt is going to be -1, so just use undef as our
-    // new pointer.
-    if (Elt == -1) {
-      NewPtr = DAG.getUNDEF(NewPtr.getValueType());
-    } else if (Elt) {
+    
+    if (Elt) {
       PtrOff = LVT.getSizeInBits() * Elt / 8;
       EVT PtrType = NewPtr.getValueType();
       if (TLI.isBigEndian())





More information about the llvm-commits mailing list