[clang] [clang][NFCI] Fix getGridValues for unsupported targets (PR #131023)
Nick Sarnie via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 12 13:41:41 PDT 2025
https://github.com/sarnex updated https://github.com/llvm/llvm-project/pull/131023
>From 700cedcb1e2c241452f34177d1a597c3d3386e9d Mon Sep 17 00:00:00 2001
From: "Sarnie, Nick" <nick.sarnie at intel.com>
Date: Wed, 12 Mar 2025 13:27:56 -0700
Subject: [PATCH] [clang][NFCI] Fix getGridValues for unsupported targets
Signed-off-by: Sarnie, Nick <nick.sarnie at intel.com>
---
clang/include/clang/Basic/TargetInfo.h | 2 +-
clang/lib/Basic/Targets/SPIR.h | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
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
More information about the cfe-commits
mailing list