<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Sat, Oct 29, 2016 at 2:04 AM Davide Italiano via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: davide<br class="gmail_msg">
Date: Fri Oct 28 18:55:32 2016<br class="gmail_msg">
New Revision: 285480<br class="gmail_msg">
<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=285480&view=rev" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project?rev=285480&view=rev</a><br class="gmail_msg">
Log:<br class="gmail_msg">
[DAGCombiner] Fix a crash visiting `AND` nodes.<br class="gmail_msg">
<br class="gmail_msg">
Instead of asserting that the shift count is != 0 we just bail out<br class="gmail_msg">
as it's not profitable trying to optimize a node which will be<br class="gmail_msg">
removed anyway.<br class="gmail_msg">
<br class="gmail_msg">
Differential Revision: <a href="https://reviews.llvm.org/D26098" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D26098</a><br class="gmail_msg">
<br class="gmail_msg">
Added:<br class="gmail_msg">
llvm/trunk/test/CodeGen/X86/pr30813.s<br class="gmail_msg">
Modified:<br class="gmail_msg">
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=285480&r1=285479&r2=285480&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=285480&r1=285479&r2=285480&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)<br class="gmail_msg">
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Oct 28 18:55:32 2016<br class="gmail_msg">
@@ -3046,6 +3046,11 @@ SDValue DAGCombiner::visitANDLike(SDValu<br class="gmail_msg">
unsigned Size = VT.getSizeInBits();<br class="gmail_msg">
const APInt &AndMask = CAnd->getAPIntValue();<br class="gmail_msg">
unsigned ShiftBits = CShift->getZExtValue();<br class="gmail_msg">
+<br class="gmail_msg">
+ // Bail out, this node will probably disappear anyway.<br class="gmail_msg">
+ if (ShiftBits == 0)<br class="gmail_msg">
+ return SDValue();<br class="gmail_msg">
+<br class="gmail_msg">
unsigned MaskBits = AndMask.countTrailingOnes();<br class="gmail_msg">
EVT HalfVT = EVT::getIntegerVT(*DAG.getContext(), Size / 2);<br class="gmail_msg">
<br class="gmail_msg">
@@ -3064,7 +3069,7 @@ SDValue DAGCombiner::visitANDLike(SDValu<br class="gmail_msg">
// extended to handle extensions mixed in.<br class="gmail_msg">
<br class="gmail_msg">
SDValue SL(N0);<br class="gmail_msg">
- assert(ShiftBits != 0 && MaskBits <= Size);<br class="gmail_msg">
+ assert(MaskBits <= Size);<br class="gmail_msg">
<br class="gmail_msg">
// Extracting the highest bit of the low half.<br class="gmail_msg">
EVT ShiftVT = TLI.getShiftAmountTy(HalfVT, DAG.getDataLayout());<br class="gmail_msg">
<br class="gmail_msg">
Added: llvm/trunk/test/CodeGen/X86/pr30813.s<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pr30813.s?rev=285480&view=auto" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pr30813.s?rev=285480&view=auto</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/test/CodeGen/X86/pr30813.s (added)<br class="gmail_msg"></blockquote><div><br></div><div>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?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+++ llvm/trunk/test/CodeGen/X86/pr30813.s Fri Oct 28 18:55:32 2016<br class="gmail_msg">
@@ -0,0 +1,20 @@<br class="gmail_msg">
+ .text<br class="gmail_msg">
+ .file "/home/davide/work/llvm/test/CodeGen/X86/visitand-shift.ll"<br class="gmail_msg">
+ .globl patatino<br class="gmail_msg">
+ .p2align 4, 0x90<br class="gmail_msg">
+ .type patatino,@function<br class="gmail_msg">
+patatino: # @patatino<br class="gmail_msg">
+ .cfi_startproc<br class="gmail_msg">
+# BB#0:<br class="gmail_msg">
+ # implicit-def: %RAX<br class="gmail_msg">
+ movzwl (%rax), %ecx<br class="gmail_msg">
+ movl %ecx, %eax<br class="gmail_msg">
+ # implicit-def: %RDX<br class="gmail_msg">
+ movq %rax, (%rdx)<br class="gmail_msg">
+ retq<br class="gmail_msg">
+.Lfunc_end0:<br class="gmail_msg">
+ .size patatino, .Lfunc_end0-patatino<br class="gmail_msg">
+ .cfi_endproc<br class="gmail_msg">
+<br class="gmail_msg">
+<br class="gmail_msg">
+ .section ".note.GNU-stack","",@progbits<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
llvm-commits mailing list<br class="gmail_msg">
<a href="mailto:llvm-commits@lists.llvm.org" class="gmail_msg" target="_blank">llvm-commits@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br class="gmail_msg">
</blockquote></div></div>