[llvm] r342397 - Revert "Revert r342183 "[DAGCombine] Fix crash when store merging created an extract_subvector with invalid index.""

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 24 01:20:34 PDT 2018


On Mon, Sep 17, 2018 at 4:40 PM, Amara Emerson via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: aemerson
> Date: Mon Sep 17 07:40:13 2018
> New Revision: 342397
>
> URL: http://llvm.org/viewvc/llvm-project?rev=342397&view=rev
> Log:
> Revert "Revert r342183 "[DAGCombine] Fix crash when store merging created an extract_subvector with invalid index.""
>
> Fixed the assertion failure.
>
> Added:
>     llvm/trunk/test/CodeGen/X86/merge-vector-stores-scale-idx-crash.ll
> 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=342397&r1=342396&r2=342397&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Sep 17 07:40:13 2018
> @@ -13870,17 +13870,26 @@ bool DAGCombiner::MergeStoresOfConstants
>               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";

We received reports from developers that the compiler now prints
"hit!" while compiling some parts of Chromium ;-)

I assume you didn't mean to leave that in, so I've removed it in r342397.


More information about the llvm-commits mailing list