svn commit: r342592 - head/contrib/llvm/lib/CodeGen/SelectionDAG

Dimitry Andric dim at FreeBSD.org
Sat Dec 29 15:13:50 UTC 2018


Author: dim
Date: Sat Dec 29 15:13:49 2018
New Revision: 342592
URL: https://svnweb.freebsd.org/changeset/base/342592

Log:
  Pull in r342397 from upstream llvm trunk (by Amara Emerson):
  
    Revert "Revert r342183 "[DAGCombine] Fix crash when store merging
    created an extract_subvector with invalid index.""
  
    Fixed the assertion failure.
  
    Differential Revision: https://reviews.llvm.org/D51831
  
  This fixes 'Assertion failed: ((VT.getVectorNumElements() +
  N2C->getZExtValue() <= N1.getValueType().getVectorNumElements()) &&
  "Extract subvector overflow!"), function getNode' when building the
  multimedia/aom port (with AVX2 enabled).
  
  Reported by:	jbeich
  PR:		234480
  MFC after:	6 weeks
  X-MFC-With:	r341825

Modified:
  head/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: head/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
==============================================================================
--- head/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Sat Dec 29 14:48:51 2018	(r342591)
+++ head/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Sat Dec 29 15:13:49 2018	(r342592)
@@ -13727,17 +13727,26 @@ bool DAGCombiner::MergeStoresOfConstantsOrVecElts(
              Val.getOpcode() == ISD::EXTRACT_SUBVECTOR)) {
           SDValue Vec = Val.getOperand(0);
           EVT MemVTScalarTy = MemVT.getScalarType();
+          SDValue Idx = Val.getOperand(1);
           // We may need to add a bitcast here to get types to line up.
           if (MemVTScalarTy != Vec.getValueType()) {
             unsigned Elts = Vec.getValueType().getSizeInBits() /
                             MemVTScalarTy.getSizeInBits();
+            if (Val.getValueType().isVector() && MemVT.isVector()) {
+              unsigned IdxC = cast<ConstantSDNode>(Idx)->getZExtValue();
+              unsigned NewIdx =
+                  ((uint64_t)IdxC * MemVT.getVectorNumElements()) / Elts;
+              Idx = DAG.getConstant(NewIdx, SDLoc(Val), Idx.getValueType());
+            }
+            if (!MemVT.isVector() && Val.getValueType().isVector())
+              dbgs() << "hit!\n";
             EVT NewVecTy =
                 EVT::getVectorVT(*DAG.getContext(), MemVTScalarTy, Elts);
             Vec = DAG.getBitcast(NewVecTy, Vec);
           }
           auto OpC = (MemVT.isVector()) ? ISD::EXTRACT_SUBVECTOR
                                         : ISD::EXTRACT_VECTOR_ELT;
-          Val = DAG.getNode(OpC, SDLoc(Val), MemVT, Vec, Val.getOperand(1));
+          Val = DAG.getNode(OpC, SDLoc(Val), MemVT, Vec, Idx);
         }
         Ops.push_back(Val);
       }


More information about the svn-src-head mailing list