<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 28, 2015 at 2:24 PM, Artem Belevich <span dir="ltr"><<a href="mailto:tra@google.com" target="_blank">tra@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Tue, Apr 28, 2015 at 1:47 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span>--- test/SemaCUDA/<a href="http://qualifiers.cu" target="_blank">qualifiers.cu</a><br>
+++ test/SemaCUDA/<a href="http://qualifiers.cu" target="_blank">qualifiers.cu</a><br>
</span>@@ -1,21 +1,35 @@<br>
 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s<br>
<span> // RUN: %clang_cc1 -triple nvptx-unknown-cuda -fsyntax-only -verify -fcuda-is-device %s<br>
+//<br>
</span>+// We run clang_cc1 with 'not' because source file contains<br>
+// intentional errors. CC1 failure is expected and must be ignored<br>
+// here. We're interested in what ends up in AST and that's what<br>
+// FileCheck verifies.<br></blockquote></div></div><div><br>Why are there errors? (the ast of code that is incorrect isn't really guaranteed, so this might be an unstable/unreliable test - perhaps we could split out the error cases from the successful cases (& I'd still like to consider IRGen testing the successful cases, rather than checking the AST - the former seems like a better contract for Clang to abide by (the AST is a bit more of an implementation detail)))<br> </div></div></div></div></blockquote><div><br></div></span><div>The source code is syntactically valid. TLS is not supported by NVPTX and that's what produces the errors.</div><div>IRGen is not going to work here, because host variables will not generate any code during device-side compilation. <br></div><div><br></div><div>I guess I could extract a subset of this test that does not produce any errors but which would still allow me to check correctness of AST in a subset of practically useful cases. It does not help with potential instability of AST, though.</div></div></div></div></blockquote><div><br>So what's the observable behavior of this change? "<span style="font-family:monospace">we've lost information which is useful during source analysis."</span><font face="arial, helvetica, sans-serif"> - <font face="arial, helvetica, sans-serif">useful for what? Diagnostic messages? Then could we -verify check one of those diagnostics?</font><br> </font></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>--Artem</div><div><div class="h5"><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div>
<span>+// RUN: not %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -ast-dump %s \<br>
+// RUN:   | FileCheck %s --check-prefix=CHECK-ALL --check-prefix=CHECK-HOST<br>
</span><div><div>+// RUN: not %clang_cc1 -triple nvptx-unknown-cuda -fsyntax-only -ast-dump -fcuda-is-device %s \<br>
+// RUN:   | FileCheck %s --check-prefix=CHECK-ALL --check-prefix=CHECK-DEVICE<br>
<br>
 #include "Inputs/cuda.h"<br>
<br>
 // Host (x86) supports TLS and device-side compilation should ignore<br>
 // host variables. No errors in either case.<br>
 int __thread host_tls_var;<br>
+// CHECK-ALL: host_tls_var 'int' tls<br>
<br>
 #if defined(__CUDA_ARCH__)<br>
 // NVPTX does not support TLS<br>
 __device__ int __thread device_tls_var; // expected-error {{thread-local storage is not supported for the current target}}<br>
+// CHECK-DEVICE: device_tls_var 'int' tls<br>
 __shared__ int __thread shared_tls_var; // expected-error {{thread-local storage is not supported for the current target}}<br>
+// CHECK-DEVICE: shared_tls_var 'int' tls<br>
 #else<br>
 // Device-side vars should not produce any errors during host-side<br>
 // compilation.<br>
 __device__ int __thread device_tls_var;<br>
+// CHECK-HOST: device_tls_var 'int' tls<br>
 __shared__ int __thread shared_tls_var;<br>
+// CHECK-HOST: shared_tls_var 'int' tls<br>
 #endif<br>
<br>
 __global__ void g1(int x) {}<br>
<br>
EMAIL PREFERENCES<br>
  <a href="http://reviews.llvm.org/settings/panel/emailpreferences/" target="_blank">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br>
</div></div><br></div></div>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div></div>
</blockquote></div></div></div><span class=""><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr">--Artem Belevich</div></div>
</font></span></div></div>
</blockquote></div><br></div></div>