[llvm] r349390 - [SelectionDAG] Fix noop detection for vectors in AssertZext/AssertSext in getNode

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 17 12:29:13 PST 2018


Author: ctopper
Date: Mon Dec 17 12:29:13 2018
New Revision: 349390

URL: http://llvm.org/viewvc/llvm-project?rev=349390&view=rev
Log:
[SelectionDAG] Fix noop detection for vectors in AssertZext/AssertSext in getNode

The assertion type is always supposed to be a scalar type. So if the result VT of the assertion is a vector, we need to get the scalar VT before we can compare them.

Similarly for the assert above it.

I don't have a test case because I don't know of any place we violate this today. A coworker found this while trying to use r347287 on the 6.0 branch without also having r336868

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

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=349390&r1=349389&r2=349390&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Dec 17 12:29:13 2018
@@ -4842,8 +4842,8 @@ SDValue SelectionDAG::getNode(unsigned O
     assert(!EVT.isVector() &&
            "AssertSExt/AssertZExt type should be the vector element type "
            "rather than the vector type!");
-    assert(EVT.bitsLE(VT) && "Not extending!");
-    if (VT == EVT) return N1; // noop assertion.
+    assert(EVT.bitsLE(VT.getScalarType()) && "Not extending!");
+    if (VT.getScalarType() == EVT) return N1; // noop assertion.
     break;
   }
   case ISD::SIGN_EXTEND_INREG: {




More information about the llvm-commits mailing list