[clang] [llvm] [Driver][SYCL] Add initial SYCL offload compilation support (PR #107493)

Tom Honermann via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 18 08:44:05 PST 2024


================
@@ -6592,6 +6672,19 @@ const ToolChain &Driver::getOffloadingDeviceToolChain(
                                                            HostTC, Args);
       break;
     }
+    case Action::OFK_SYCL:
+      switch (Target.getArch()) {
+      case llvm::Triple::spir:
+      case llvm::Triple::spir64:
+      case llvm::Triple::spirv32:
+      case llvm::Triple::spirv64:
+        TC = std::make_unique<toolchains::SYCLToolChain>(*this, Target, HostTC,
+                                                         Args);
+        break;
+      default:
+        break;
+      }
+      break;
     default:
       break;
----------------
tahonermann wrote:

It seems that something needs to be done in these default cases. In this context, `TC` is known to be null, but falling through leads to an unconditional dereference of it below. Some `llvm_unreachable()` or similar calls seem appropriate.

https://github.com/llvm/llvm-project/pull/107493


More information about the cfe-commits mailing list