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;
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;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits