[Openmp-commits] [PATCH] D93786: [OpenMP][Fix] Make the arch selector for x86_64 work
Johannes Doerfert via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Thu Jan 7 12:31:48 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd970a285b856: [OpenMP][Fix] Make the arch selector for x86_64 work (authored by jdoerfert).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93786/new/
https://reviews.llvm.org/D93786
Files:
clang/test/OpenMP/declare_variant_ast_x86_64.c
llvm/lib/Frontend/OpenMP/OMPContext.cpp
Index: llvm/lib/Frontend/OpenMP/OMPContext.cpp
===================================================================
--- llvm/lib/Frontend/OpenMP/OMPContext.cpp
+++ llvm/lib/Frontend/OpenMP/OMPContext.cpp
@@ -14,7 +14,9 @@
#include "llvm/Frontend/OpenMP/OMPContext.h"
#include "llvm/ADT/SetOperations.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
+#include "llvm/ADT/Triple.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
@@ -58,9 +60,12 @@
// Add the appropriate device architecture trait based on the triple.
#define OMP_TRAIT_PROPERTY(Enum, TraitSetEnum, TraitSelectorEnum, Str) \
- if (TraitSelector::TraitSelectorEnum == TraitSelector::device_arch) \
+ if (TraitSelector::TraitSelectorEnum == TraitSelector::device_arch) { \
if (TargetTriple.getArch() == TargetTriple.getArchTypeForLLVMName(Str)) \
- ActiveTraits.set(unsigned(TraitProperty::Enum));
+ ActiveTraits.set(unsigned(TraitProperty::Enum)); \
+ if (Str == "x86_64" && TargetTriple.getArch() == Triple::x86_64) \
+ ActiveTraits.set(unsigned(TraitProperty::Enum)); \
+ }
#include "llvm/Frontend/OpenMP/OMPKinds.def"
// TODO: What exactly do we want to see as device ISA trait?
Index: clang/test/OpenMP/declare_variant_ast_x86_64.c
===================================================================
--- /dev/null
+++ clang/test/OpenMP/declare_variant_ast_x86_64.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-unknown-unknown %s -ast-dump | FileCheck %s
+// expected-no-diagnostics
+
+#pragma omp begin declare variant match(device={arch(x86_64)})
+
+void bar() {}
+
+// CHECK: FunctionDecl {{.*}} bar[device={arch(x86_64)}] 'void ()'
+
+#pragma omp end declare variant
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93786.315207.patch
Type: text/x-patch
Size: 1836 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210107/5564ac5b/attachment.bin>
More information about the Openmp-commits
mailing list