[PATCH] D89904: [OpenMP] Fixing OpenMP/driver.c failing on 32-bit hosts

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 21 11:40:41 PDT 2020


jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, daltenty.
Herald added subscribers: cfe-commits, guansong, yaxunl.
Herald added a project: clang.
jhuber6 requested review of this revision.
Herald added a subscriber: sstefan1.

The changes made in D88594 <https://reviews.llvm.org/D88594> caused the test OpenMP/driver.c to fail on a 32-bit host becuase it was offloading to a 64-bit architecture by default. The offloading test was moved to a new file and a feature was added to the lit config to check for a 64-bit host.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89904

Files:
  clang/test/OpenMP/driver-openmp-target.c
  clang/test/lit.cfg.py
  clang/test/lit.site.cfg.py.in


Index: clang/test/lit.site.cfg.py.in
===================================================================
--- clang/test/lit.site.cfg.py.in
+++ clang/test/lit.site.cfg.py.in
@@ -13,6 +13,7 @@
 config.clang_src_dir = path(r"@CLANG_SOURCE_DIR@")
 config.clang_tools_dir = path(r"@CLANG_TOOLS_DIR@")
 config.host_triple = "@LLVM_HOST_TRIPLE@"
+config.target_triple = "@LLVM_TARGET_TRIPLE_ENV@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.host_cxx = "@CMAKE_CXX_COMPILER@"
 config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
@@ -31,6 +32,7 @@
 config.use_z3_solver = lit_config.params.get('USE_Z3_SOLVER', "@USE_Z3_SOLVER@")
 config.has_plugins = @LLVM_ENABLE_PLUGINS@
 config.clang_vendor_uti = "@CLANG_VENDOR_UTI@"
+config.host_ldflags = '@HOST_LDFLAGS@'
 
 # Support substitution of the tools and libs dirs with user parameters. This is
 # used when we can't determine the tool dir at configuration time.
Index: clang/test/lit.cfg.py
===================================================================
--- clang/test/lit.cfg.py
+++ clang/test/lit.cfg.py
@@ -1,7 +1,6 @@
 # -*- Python -*-
 
 import os
-import sys
 import platform
 import re
 import subprocess
@@ -168,9 +167,12 @@
 if platform.system() not in ['Windows']:
     config.available_features.add('can-remove-opened-file')
 
-# Check 64-bit host
-if sys.maxsize > 2**32:
-  config.available_features.add("clang-64-bits")
+# Features
+known_arches = ["x86_64", "mips64", "ppc64", "aarch64"]
+if (config.host_ldflags.find("-m32") < 0
+    and any(config.host_triple.startswith(x) for x in known_arches)):
+  config.available_features.add("clang-target-64-bits")
+
 
 
 def calculate_arch_features(arch_string):
Index: clang/test/OpenMP/driver-openmp-target.c
===================================================================
--- clang/test/OpenMP/driver-openmp-target.c
+++ clang/test/OpenMP/driver-openmp-target.c
@@ -1,5 +1,5 @@
 // REQUIRES: x86-registered-target
-// REQUIRES: clang-64-bits
+// REQUIRES: clang-target-64-bits
 // RUN: %clang %s -c -E -dM -fopenmp=libomp -fopenmp-version=45 -fopenmp-targets=x86_64-unknown-unknown -o - | FileCheck --check-prefix=CHECK-45-VERSION --check-prefix=CHECK-45-VERSION2 %s
 // CHECK-45-VERSION: #define _OPENMP 201511
 // CHECK-45-VERSION2: #define _OPENMP 201511


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89904.299765.patch
Type: text/x-patch
Size: 2276 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201021/a3af0fef/attachment-0001.bin>


More information about the cfe-commits mailing list