[clang] 7b710a4 - [OPENMP]Improve diagnostics for unsupported unified addressing.
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 5 08:29:44 PST 2019
Author: Alexey Bataev
Date: 2019-11-05T10:31:59-05:00
New Revision: 7b710a4294c1baed0157d86d3e2dabac78c306ce
URL: https://github.com/llvm/llvm-project/commit/7b710a4294c1baed0157d86d3e2dabac78c306ce
DIFF: https://github.com/llvm/llvm-project/commit/7b710a4294c1baed0157d86d3e2dabac78c306ce.diff
LOG: [OPENMP]Improve diagnostics for unsupported unified addressing.
Improved diagnostics for better user experience.
Added:
Modified:
clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
clang/test/OpenMP/requires_codegen.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
index eab2d7be1aeb..96716c0edd9f 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
@@ -4954,7 +4954,8 @@ void CGOpenMPRuntimeNVPTX::checkArchForUnifiedAddressing(
const OMPRequiresDecl *D) {
for (const OMPClause *Clause : D->clauselists()) {
if (Clause->getClauseKind() == OMPC_unified_shared_memory) {
- switch (getCudaArch(CGM)) {
+ CudaArch Arch = getCudaArch(CGM);
+ switch (Arch) {
case CudaArch::SM_20:
case CudaArch::SM_21:
case CudaArch::SM_30:
@@ -4966,10 +4967,14 @@ void CGOpenMPRuntimeNVPTX::checkArchForUnifiedAddressing(
case CudaArch::SM_53:
case CudaArch::SM_60:
case CudaArch::SM_61:
- case CudaArch::SM_62:
- CGM.Error(Clause->getBeginLoc(),
- "Target architecture does not support unified addressing");
+ case CudaArch::SM_62: {
+ SmallString<256> Buffer;
+ llvm::raw_svector_ostream Out(Buffer);
+ Out << "Target architecture " << CudaArchToString(Arch)
+ << " does not support unified addressing";
+ CGM.Error(Clause->getBeginLoc(), Out.str());
return;
+ }
case CudaArch::SM_70:
case CudaArch::SM_72:
case CudaArch::SM_75:
diff --git a/clang/test/OpenMP/requires_codegen.cpp b/clang/test/OpenMP/requires_codegen.cpp
index e94fd28b419e..84821e89ed24 100644
--- a/clang/test/OpenMP/requires_codegen.cpp
+++ b/clang/test/OpenMP/requires_codegen.cpp
@@ -21,5 +21,5 @@
#endif
#ifdef REGION_DEVICE
-#pragma omp requires unified_shared_memory // expected-error {{Target architecture does not support unified addressing}}
+#pragma omp requires unified_shared_memory // expected-error-re {{Target architecture sm_{{20|21|30|32|35|37|50|52|53|60|61|62}} does not support unified addressing}}
#endif
More information about the cfe-commits
mailing list