[llvm] r285480 - [DAGCombiner] Fix a crash visiting `AND` nodes.
Manuel Klimek via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 31 04:30:04 PDT 2016
Fixed in r285559. Let me know if that's the wrong fix.
On Mon, Oct 31, 2016 at 12:11 PM Manuel Klimek <klimek at google.com> wrote:
> On Sat, Oct 29, 2016 at 2:04 AM Davide Italiano via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
> Author: davide
> Date: Fri Oct 28 18:55:32 2016
> New Revision: 285480
>
> URL: http://llvm.org/viewvc/llvm-project?rev=285480&view=rev
> Log:
> [DAGCombiner] Fix a crash visiting `AND` nodes.
>
> Instead of asserting that the shift count is != 0 we just bail out
> as it's not profitable trying to optimize a node which will be
> removed anyway.
>
> Differential Revision: https://reviews.llvm.org/D26098
>
> Added:
> llvm/trunk/test/CodeGen/X86/pr30813.s
> 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=285480&r1=285479&r2=285480&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Oct 28
> 18:55:32 2016
> @@ -3046,6 +3046,11 @@ SDValue DAGCombiner::visitANDLike(SDValu
> unsigned Size = VT.getSizeInBits();
> const APInt &AndMask = CAnd->getAPIntValue();
> unsigned ShiftBits = CShift->getZExtValue();
> +
> + // Bail out, this node will probably disappear anyway.
> + if (ShiftBits == 0)
> + return SDValue();
> +
> unsigned MaskBits = AndMask.countTrailingOnes();
> EVT HalfVT = EVT::getIntegerVT(*DAG.getContext(), Size / 2);
>
> @@ -3064,7 +3069,7 @@ SDValue DAGCombiner::visitANDLike(SDValu
> // extended to handle extensions mixed in.
>
> SDValue SL(N0);
> - assert(ShiftBits != 0 && MaskBits <= Size);
> + assert(MaskBits <= Size);
>
> // Extracting the highest bit of the low half.
> EVT ShiftVT = TLI.getShiftAmountTy(HalfVT, DAG.getDataLayout());
>
> Added: llvm/trunk/test/CodeGen/X86/pr30813.s
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pr30813.s?rev=285480&view=auto
>
> ==============================================================================
> --- llvm/trunk/test/CodeGen/X86/pr30813.s (added)
>
>
> This file doesn't have a RUN line, and I think .s files in this directory
> are not executed by default anyway - am I holding it wrong, or did you
> intend to submit a different file?
>
>
> +++ llvm/trunk/test/CodeGen/X86/pr30813.s Fri Oct 28 18:55:32 2016
> @@ -0,0 +1,20 @@
> + .text
> + .file "/home/davide/work/llvm/test/CodeGen/X86/visitand-shift.ll"
> + .globl patatino
> + .p2align 4, 0x90
> + .type patatino, at function
> +patatino: # @patatino
> + .cfi_startproc
> +# BB#0:
> + # implicit-def: %RAX
> + movzwl (%rax), %ecx
> + movl %ecx, %eax
> + # implicit-def: %RDX
> + movq %rax, (%rdx)
> + retq
> +.Lfunc_end0:
> + .size patatino, .Lfunc_end0-patatino
> + .cfi_endproc
> +
> +
> + .section ".note.GNU-stack","", at progbits
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161031/cce80f97/attachment.html>
More information about the llvm-commits
mailing list