https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/189561
This function made no sense at all. It was scanning through the feature map looking for something that parsed as an OffloadArch. Directly compute the arch from the target device. I don't know why there isn't just an OffloadArch in TargetOpts, this shouldn't really require parsing. >From b2660a96a07e9ee132c505f84467e589a45b324c Mon Sep 17 00:00:00 2001 From: Matt Arsenault <[email protected]> Date: Tue, 31 Mar 2026 10:20:24 +0200 Subject: [PATCH] OpenMP: Reimplement getOffloadArch This function made no sense at all. It was scanning through the feature map looking for something that parsed as an OffloadArch. Directly compute the arch from the target device. I don't know why there isn't just an OffloadArch in TargetOpts, this shouldn't really require parsing. --- clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp index 4fc10e4165465..1ca04e18adcb0 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp @@ -2261,18 +2261,9 @@ bool CGOpenMPRuntimeGPU::hasAllocateAttributeForGlobalVar(const VarDecl *VD, return false; } -// Get current OffloadArch and ignore any unknown values -static OffloadArch getOffloadArch(CodeGenModule &CGM) { - if (!CGM.getTarget().hasFeature("ptx")) - return OffloadArch::Unknown; - for (const auto &Feature : CGM.getTarget().getTargetOpts().FeatureMap) { - if (Feature.getValue()) { - OffloadArch Arch = StringToOffloadArch(Feature.getKey()); - if (Arch != OffloadArch::Unknown) - return Arch; - } - } - return OffloadArch::Unknown; +static OffloadArch getOffloadArch(const CodeGenModule &CGM) { + // FIXME: This should not require parsing + return StringToOffloadArch(CGM.getTarget().getTargetOpts().CPU); } /// Check to see if target architecture supports unified addressing which is _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
