[PATCH] D96538: [SYCL] Ignore file-scope asm during device-side SYCL compilation.

Artur Gainullin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 12 13:03:09 PST 2021


ArturGainullin updated this revision to Diff 323456.
ArturGainullin added a comment.

Rebase for retesting.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96538/new/

https://reviews.llvm.org/D96538

Files:
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/test/CodeGenSYCL/filescope_asm.c


Index: clang/test/CodeGenSYCL/filescope_asm.c
===================================================================
--- /dev/null
+++ clang/test/CodeGenSYCL/filescope_asm.c
@@ -0,0 +1,6 @@
+// RUN:  %clang_cc1 -fsycl -fsycl-is-device -triple spir64-unknown-unknown-sycldevice -emit-llvm %s -o - | FileCheck %s
+//
+// Check that file-scope asm is ignored during device-side SYCL compilation.
+//
+// CHECK-NOT: module asm "foo"
+__asm__("foo");
Index: clang/lib/CodeGen/CodeGenModule.cpp
===================================================================
--- clang/lib/CodeGen/CodeGenModule.cpp
+++ clang/lib/CodeGen/CodeGenModule.cpp
@@ -5672,6 +5672,9 @@
     // File-scope asm is ignored during device-side OpenMP compilation.
     if (LangOpts.OpenMPIsDevice)
       break;
+    // File-scope asm is ignored during device-side SYCL compilation.
+    if (LangOpts.SYCLIsDevice)
+      break;
     auto *AD = cast<FileScopeAsmDecl>(D);
     getModule().appendModuleInlineAsm(AD->getAsmString()->getString());
     break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96538.323456.patch
Type: text/x-patch
Size: 1022 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210212/998883f0/attachment.bin>


More information about the cfe-commits mailing list