Author: Nick Sarnie
Date: 2025-03-13T14:28:49Z
New Revision: 7a5e4f540580d8f7e292292dc960178d8d8ba1d7

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

LOG: [clang][NFCI] Fix getGridValues for unsupported targets (#131023)

I broke this in
https://github.com/llvm/llvm-project/commit/f3cd2238383f695c719e7eab6aebec828781ec91,
I should have added this to the `SPIRV64` subclass, but I accidentally
added it to base `TargetInfo`.

Using an unsupported target should error in the driver way before this
though.

Signed-off-by: Sarnie, Nick <nick.sar...@intel.com>

Added: 
    

Modified: 
    clang/include/clang/Basic/TargetInfo.h
    clang/lib/Basic/Targets/SPIR.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Basic/TargetInfo.h 
b/clang/include/clang/Basic/TargetInfo.h
index d136b459e9cd4..497d68779b92b 100644
--- a/clang/include/clang/Basic/TargetInfo.h
+++ b/clang/include/clang/Basic/TargetInfo.h
@@ -1675,7 +1675,7 @@ class TargetInfo : public TransferrableTargetInfo,
   // access target-specific GPU grid values that must be consistent between
   // host RTL (plugin), deviceRTL and clang.
   virtual const llvm::omp::GV &getGridValue() const {
-    return llvm::omp::SPIRVGridValues;
+    llvm_unreachable("getGridValue not implemented on this target");
   }
 
   /// Retrieve the name of the platform as it is used in the

diff  --git a/clang/lib/Basic/Targets/SPIR.h b/clang/lib/Basic/Targets/SPIR.h
index 610efa1fe00d9..78505d66d6f2f 100644
--- a/clang/lib/Basic/Targets/SPIR.h
+++ b/clang/lib/Basic/Targets/SPIR.h
@@ -370,6 +370,10 @@ class LLVM_LIBRARY_VISIBILITY SPIRV64TargetInfo : public 
BaseSPIRVTargetInfo {
 
   void getTargetDefines(const LangOptions &Opts,
                         MacroBuilder &Builder) const override;
+
+  const llvm::omp::GV &getGridValue() const override {
+    return llvm::omp::SPIRVGridValues;
+  }
 };
 
 class LLVM_LIBRARY_VISIBILITY SPIRV64AMDGCNTargetInfo final


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

Reply via email to