[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
Thu Feb 11 12:59:26 PST 2021


ArturGainullin created this revision.
ArturGainullin added reviewers: bader, elizabethandrews.
Herald added subscribers: Anastasia, ebevhan, yaxunl.
ArturGainullin requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

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.323121.patch
Type: text/x-patch
Size: 1022 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210211/23914fdf/attachment.bin>


More information about the cfe-commits mailing list