[clang] 74e6ce2 - [Frontend] Allow OpenMP offloading to aarch64

Bryan Chan via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 8 11:45:50 PST 2019


Author: Bryan Chan
Date: 2019-12-08T14:45:16-05:00
New Revision: 74e6ce2529fae2c3318731c6f4f77bfa92eb6eb7

URL: https://github.com/llvm/llvm-project/commit/74e6ce2529fae2c3318731c6f4f77bfa92eb6eb7
DIFF: https://github.com/llvm/llvm-project/commit/74e6ce2529fae2c3318731c6f4f77bfa92eb6eb7.diff

LOG: [Frontend] Allow OpenMP offloading to aarch64

Summary:
D30644 added OpenMP offloading to AArch64 targets, then D32035 changed the
frontend to throw an error when offloading is requested for an unsupported
target architecture. However the latter did not include AArch64 in the list
of supported architectures, causing the following unit tests to fail:

    libomptarget :: api/omp_get_num_devices.c
    libomptarget :: mapping/pr38704.c
    libomptarget :: offloading/offloading_success.c
    libomptarget :: offloading/offloading_success.cpp

Reviewers: pawosm01, gtbercea, jdoerfert, ABataev

Subscribers: kristof.beyls, guansong, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D70804

Added: 
    

Modified: 
    clang/lib/Frontend/CompilerInvocation.cpp
    clang/test/OpenMP/openmp_offload_registration.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 198ae69b7655..1af2bdab61e4 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -3070,7 +3070,8 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
       llvm::Triple TT(A->getValue(i));
 
       if (TT.getArch() == llvm::Triple::UnknownArch ||
-          !(TT.getArch() == llvm::Triple::ppc ||
+          !(TT.getArch() == llvm::Triple::aarch64 ||
+            TT.getArch() == llvm::Triple::ppc ||
             TT.getArch() == llvm::Triple::ppc64 ||
             TT.getArch() == llvm::Triple::ppc64le ||
             TT.getArch() == llvm::Triple::nvptx ||

diff  --git a/clang/test/OpenMP/openmp_offload_registration.cpp b/clang/test/OpenMP/openmp_offload_registration.cpp
index b49af4d0e380..1aa2067ab8e8 100644
--- a/clang/test/OpenMP/openmp_offload_registration.cpp
+++ b/clang/test/OpenMP/openmp_offload_registration.cpp
@@ -1,5 +1,6 @@
-// Test for offload registration code for two targets
+// Test offload registration for two targets, and test offload target validation.
 // RUN: %clang_cc1 -verify -fopenmp -x c -triple x86_64-unknown-linux-gnu -fopenmp-targets=x86_64-pc-linux-gnu,powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -verify -fopenmp -x c -triple x86_64-unknown-linux-gnu -fopenmp-targets=aarch64-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s
 // expected-no-diagnostics
 
 void foo() {


        


More information about the cfe-commits mailing list