[clang] ff50b12 - [SYCL] Ignore file-scope asm during device-side SYCL compilation.

2021-02-12 Thread Artur Gainullin via cfe-commits

Author: Artur Gainullin
Date: 2021-02-12T17:00:45-08:00
New Revision: ff50b121e336503621da80676116f82d82e91196

URL: 
https://github.com/llvm/llvm-project/commit/ff50b121e336503621da80676116f82d82e91196
DIFF: 
https://github.com/llvm/llvm-project/commit/ff50b121e336503621da80676116f82d82e91196.diff

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

Reviewed By: bader, eandrews

Differential Revision: https://reviews.llvm.org/D96538

Added: 
clang/test/CodeGenSYCL/filescope_asm.c

Modified: 
clang/lib/CodeGen/CodeGenModule.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CodeGenModule.cpp 
b/clang/lib/CodeGen/CodeGenModule.cpp
index 6321f745593b..4688f13dae21 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -5672,6 +5672,9 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) {
 // 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(D);
 getModule().appendModuleInlineAsm(AD->getAsmString()->getString());
 break;

diff  --git a/clang/test/CodeGenSYCL/filescope_asm.c 
b/clang/test/CodeGenSYCL/filescope_asm.c
new file mode 100644
index ..5f4f6709a0e1
--- /dev/null
+++ b/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");



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 192c602 - [Driver] Make the findVCToolChainViaEnvironment case-insensitive

2021-04-13 Thread Artur Gainullin via cfe-commits

Author: Artur Gainullin
Date: 2021-04-13T13:36:37-07:00
New Revision: 192c6023e1e2f31284752d17846401158445f42d

URL: 
https://github.com/llvm/llvm-project/commit/192c6023e1e2f31284752d17846401158445f42d
DIFF: 
https://github.com/llvm/llvm-project/commit/192c6023e1e2f31284752d17846401158445f42d.diff

LOG: [Driver] Make the findVCToolChainViaEnvironment case-insensitive

PATH usage on Windows is case-insensitive. There could be situations
when toolchain path can't be obtained from PATH because of
case-sensitivity of the findVCToolChainViaEnvironment.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D100361

Added: 


Modified: 
clang/lib/Driver/ToolChains/MSVC.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/MSVC.cpp 
b/clang/lib/Driver/ToolChains/MSVC.cpp
index 877919e11464..2fddbd6829fa 100644
--- a/clang/lib/Driver/ToolChains/MSVC.cpp
+++ b/clang/lib/Driver/ToolChains/MSVC.cpp
@@ -190,13 +190,15 @@ findVCToolChainViaEnvironment(llvm::vfs::FileSystem &VFS, 
std::string &Path,
   if (IsBin) {
 llvm::StringRef ParentPath = llvm::sys::path::parent_path(TestPath);
 llvm::StringRef ParentFilename = llvm::sys::path::filename(ParentPath);
-if (ParentFilename == "VC") {
+if (ParentFilename.equals_lower("VC")) {
   Path = std::string(ParentPath);
   VSLayout = MSVCToolChain::ToolsetLayout::OlderVS;
   return true;
 }
-if (ParentFilename == "x86ret" || ParentFilename == "x86chk"
-  || ParentFilename == "amd64ret" || ParentFilename == "amd64chk") {
+if (ParentFilename.equals_lower("x86ret") ||
+ParentFilename.equals_lower("x86chk") ||
+ParentFilename.equals_lower("amd64ret") ||
+ParentFilename.equals_lower("amd64chk")) {
   Path = std::string(ParentPath);
   VSLayout = MSVCToolChain::ToolsetLayout::DevDivInternal;
   return true;
@@ -215,7 +217,7 @@ findVCToolChainViaEnvironment(llvm::vfs::FileSystem &VFS, 
std::string &Path,
 for (llvm::StringRef Prefix : ExpectedPrefixes) {
   if (It == End)
 goto NotAToolChain;
-  if (!It->startswith(Prefix))
+  if (!It->startswith_lower(Prefix))
 goto NotAToolChain;
   ++It;
 }



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits