================ @@ -0,0 +1,10 @@ +// RUN: not %clang_cc1 -triple x86_64-unknown-unknown -fsycl-is-device %s 2>&1 | FileCheck --check-prefixes=INVALID %s ---------------- elizabethandrews wrote:
> Ah, no I was probably too eager giving my LGTM on this. I'm curious why this > is checked by a FileCheck and not by -verify? I wasn't sure how to test errors thrown by `Frontend` component and I checked a couple of other tests in the folder and saw this was how the errors were tested. So I followed what I saw. > And why no target passed at all is considered valid? Clang always assumes a default target. If no triple is passed Clang assumes the target is the system that the compiler was built on. This is what caused the crash you saw for `cc1`. Since you did not pass a triple, Clang probably assumed it was `x86_64`, which is an invalid target for SYCL device compilation causing a crash further down the stack. This PR modifies the default to `"spirv64-unknown-unknown"`for SYCL device compilation for `cc1` compilations to match what the driver does when a user does not specify a target. > Also, can we please add a test that actually has an attribute > [[clang::sycl_kernel_entry_point]] on a function and actually tries to emit > IR with an invalid target? I.e. can we add a test with the original > reproducer from https://github.com/llvm/llvm-project/issues/167358 to verify > there is no crash anymore? I can but the test code does not matter here actually. Target testing is down much higher up in the stack. So this error is purely based on specified/unspecified triple and LangOpts. Your test in https://github.com/llvm/llvm-project/issues/167358 will now pass since a default of `spirv64-unknown-unknown` will be assumed by the compiler instead of `x86_64` https://github.com/llvm/llvm-project/pull/172366 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
