From: Craig Topper Date: Mon, 17 Dec 2018 20:29:13 +0000 (+0000) Subject: [SelectionDAG] Fix noop detection for vectors in AssertZext/AssertSext in getNode X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b7aabefcef8a00f5b6d12b488fa6aed907c5a46c;p=llvm [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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@349390 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 6241af1332f..d69e50d9007 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -4842,8 +4842,8 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT, 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: {