<div dir="ltr">That's it, thanks for checking that.<div><br></div><div>Looks like APInt::uge first truncs the uint64_t value to it's size and then compares. In this case it will trunc 256 to i8 what is 0.</div><div><br></div><div>Paweł</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jun 23, 2015 at 3:15 AM Frédéric Riss <<a href="mailto:friss@apple.com">friss@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><blockquote type="cite">On Jun 22, 2015, at 3:08 PM, Frédéric Riss <<a href="mailto:friss@apple.com" target="_blank">friss@apple.com</a>> wrote:<br><br><blockquote type="cite" style="font-family:Menlo-Regular;font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:13px;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br>On Jun 22, 2015, at 2:59 PM, Paweł Bylica <<a href="mailto:chfast@gmail.com" target="_blank">chfast@gmail.com</a>> wrote:<br><br>Reverted in r240343. I'm finishing for today. Sorry for the troubles, but it's quite a surprise for me. <br></blockquote><br>Honestly, nothing obvious seems wrong with the commit, so I understand your surprise, but the facts seems to show otherwise :-/<br><br><blockquote type="cite" style="font-family:Menlo-Regular;font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:13px;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">How can I reproduce the problem locally?<br></blockquote><br>I would guess that recompiling a clang using a clang that has your change should expose the issue (that’s what I would expect the <br>clang-x86_64-linux-selfhost-abi-test does. I’ll try it myself and see if I can get you some data.<br></blockquote><br></div><div style="word-wrap:break-word">Your revert seems to have fixed the bots.<br><br>I compiled a clang with a clang that I instrumented to see where your new version would produce a different results that the old one. Here’s one case I found:<br><br>(lldb) p N1C->dump()<br>0x11a9666b0: i8 = Constant<-64><br>(lldb) p OpSizeInBits<br>(unsigned int) $1 = 256<br><br>It happens when compiling:<br>clang::ASTReader::ParseDiagnosticOptions(llvm::SmallVector<unsigned long long, 64u> const&, bool, clang::ASTReaderListener&)<br>in <clang>/lib/Serialization/ASTReader.cpp <br><br>Hope this helps you find what is wrong.<br><br>Fred</div><div style="word-wrap:break-word"><br><br><blockquote type="cite">Fred<br><br><blockquote type="cite" style="font-family:Menlo-Regular;font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:13px;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">On Mon, Jun 22, 2015 at 11:38 PM Frédéric Riss <<a href="mailto:friss@apple.com" target="_blank">friss@apple.com</a>> wrote:<br><blockquote type="cite">On Jun 22, 2015, at 1:57 PM, Paweł Bylica <<a href="mailto:chfast@gmail.com" target="_blank">chfast@gmail.com</a>> wrote:<br><br>I'm about to send a change that will fix the regression test (it should be -march=x86). It should fix build failures like:<br><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lab.llvm.org-3A8011_builders_llvm-2Ds390x-2Dlinux1_builds_16458&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=s3i6aISbFXbynSQklomqTZ72XGDZNgLt6W_YY2RsKMU&s=WtalVDR3yKkU4UbdVC_a2Oy-IDArTEkgCNKg52EsmF8&e=" target="_blank">http://lab.llvm.org:8011/builders/llvm-s390x-linux1/builds/16458</a><br><br>However your is similar to that one:<br><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lab.llvm.org-3A8011_builders_clang-2Dx86-5F64-2Dlinux-2Dselfhost-2Dabi-2Dtest_builds_5852&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=s3i6aISbFXbynSQklomqTZ72XGDZNgLt6W_YY2RsKMU&s=VfsCB7Ij8IBdXm1gyfmvYk_t7irCmbfZ3vTRfBwnSkA&e=" target="_blank">http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-abi-test/builds/5852</a><br>but I'm not sure what's wrong with that.<br><br>Give me 10 more minutes. If it will not help, please revert it.<br></blockquote><br>I just saw your commit. I think there is no way that your fix in the test could fix any of the self host issues (the green dragon failure is a self-hosted LTO build and the other failing bot you pointed me at is also a self-host). Are you investigating the other failures? The 2 failing bots have only your commit in common in their blame lists so at this point it’s pretty clear that this commit triggers something very wrong in a clang self-host build. It  should be pretty easy to reproduce. I’d appreciate if you revert this change so that the bots can become green again. <br><br>Fred <br><br><blockquote type="cite">- Paweł<br><br><br><br>On Mon, Jun 22, 2015 at 10:47 PM Frédéric Riss <<a href="mailto:friss@apple.com" target="_blank">friss@apple.com</a>> wrote:<br>This commit is by far the most likely culprit for the hangs we see on green dragon:<br><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lab.llvm.org-3A8080_green_job_clang-2Dstage2-2Dconfigure-2DRlto-5Fcheck_&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=s3i6aISbFXbynSQklomqTZ72XGDZNgLt6W_YY2RsKMU&s=OMHYAVH58DuYpiUr6N5jf_l3MAQ1fZN5MMmD8NojuF0&e=" target="_blank">http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/</a><br><br>Did you have any other failures? Would you mind reverting it to see if it fixes things? (This is after an LTO bootstrap, so it takes quite some time to reproduce/propagate).<br><br>Fred<br><br><blockquote type="cite">On Jun 22, 2015, at 8:58 AM, Pawel Bylica <<a href="mailto:chfast@gmail.com" target="_blank">chfast@gmail.com</a>> wrote:<br><br>Author: chfast<br>Date: Mon Jun 22 10:58:11 2015<br>New Revision: 240291<br><br>URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D240291-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=s3i6aISbFXbynSQklomqTZ72XGDZNgLt6W_YY2RsKMU&s=V7DMXF-Xu4xJPbkCoGHX0UitZBuoV7Id-mhHjchb6-U&e=" target="_blank">http://llvm.org/viewvc/llvm-project?rev=240291&view=rev</a><br>Log:<br>Fix shl folding in DAG combiner.<br><br>Summary: The code responsible for shl folding in the DAGCombiner was assuming incorrectly that all constants are less than 64 bits. This patch simply changes the way values are compared.<br><br>Test Plan: A regression test included.<br><br>Reviewers: andreadb<br><br>Reviewed By: andreadb<br><br>Subscribers: andreadb, test, llvm-commits<br><br>Differential Revision: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D10602&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=s3i6aISbFXbynSQklomqTZ72XGDZNgLt6W_YY2RsKMU&s=dmiKBVsA9Nrdpsu0ly4crk1vV4Q54C2h32yCABN5Qtw&e=" target="_blank">http://reviews.llvm.org/D10602</a><br><br>Added:<br>  llvm/trunk/test/CodeGen/X86/fold-vector-shl-crash.ll<br>Modified:<br>  llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp<br><br>Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp<br>URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_SelectionDAG_DAGCombiner.cpp-3Frev-3D240291-26r1-3D240290-26r2-3D240291-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=s3i6aISbFXbynSQklomqTZ72XGDZNgLt6W_YY2RsKMU&s=w3GVRJq0NltJ1wcihzlgsEScfH_iFY2WJEbdvtoJp_s&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=240291&r1=240290&r2=240291&view=diff</a><br>==============================================================================<br>--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)<br>+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Jun 22 10:58:11 2015<br>@@ -4275,7 +4275,7 @@ SDValue DAGCombiner::visitSHL(SDNode *N)<br> if (isNullConstant(N0))<br>   return N0;<br> // fold (shl x, c >= size(x)) -> undef<br>-  if (N1C && N1C->getZExtValue() >= OpSizeInBits)<br>+  if (N1C && N1C->getAPIntValue().uge(OpSizeInBits))<br>   return DAG.getUNDEF(VT);<br> // fold (shl x, 0) -> x<br> if (N1C && N1C->isNullValue())<br><br>Added: llvm/trunk/test/CodeGen/X86/fold-vector-shl-crash.ll<br>URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_CodeGen_X86_fold-2Dvector-2Dshl-2Dcrash.ll-3Frev-3D240291-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=s3i6aISbFXbynSQklomqTZ72XGDZNgLt6W_YY2RsKMU&s=Npxq4rUT71xxeDq098ER3HpkRS9eSuzIxEhDZMQi5Yw&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fold-vector-shl-crash.ll?rev=240291&view=auto</a><br>==============================================================================<br>--- llvm/trunk/test/CodeGen/X86/fold-vector-shl-crash.ll (added)<br>+++ llvm/trunk/test/CodeGen/X86/fold-vector-shl-crash.ll Mon Jun 22 10:58:11 2015<br>@@ -0,0 +1,8 @@<br>+; RUN: llc < %s | FileCheck %s<br>+<br>+;CHECK-LABEL: test<br>+define <2 x i256> @test() {<br>+  %S = shufflevector <2 x i256> zeroinitializer, <2 x i256> <i256 -1, i256 -1>, <2 x i32> <i32 0, i32 2><br>+  %B = shl <2 x i256> %S, <i256 -1, i256 -1> ; DAG Combiner crashes here<br>+  ret <2 x i256> %B<br>+}<br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br></blockquote><br></blockquote></blockquote><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br></blockquote><br></div></blockquote></div>