[llvm] Reapply "Update Benchmark (#83488)" (PR #83916)

via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 4 14:08:27 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-third-party-benchmark

Author: Mircea Trofin (mtrofin)

<details>
<summary>Changes</summary>

This reverts commit aec6a04b8e99b42eca431fc0b56947937d3a14c2.

(google/benchmark at hash 1576991177ba97a4b2ff6c45950f1fa6e9aa678c)

verified locally.

---

Patch is 443.34 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/83916.diff


131 Files Affected:

- (added) third-party/benchmark/.pre-commit-config.yaml (+18) 
- (modified) third-party/benchmark/.ycm_extra_conf.py (+6-2) 
- (modified) third-party/benchmark/AUTHORS (+11-1) 
- (modified) third-party/benchmark/CMakeLists.txt (+56-44) 
- (modified) third-party/benchmark/CONTRIBUTORS (+12-2) 
- (added) third-party/benchmark/MODULE.bazel (+32) 
- (modified) third-party/benchmark/README.md (+10-3) 
- (modified) third-party/benchmark/WORKSPACE (+20-34) 
- (added) third-party/benchmark/WORKSPACE.bzlmod (+2) 
- (added) third-party/benchmark/bazel/benchmark_deps.bzl (+62) 
- (modified) third-party/benchmark/bindings/python/build_defs.bzl (+6-2) 
- (modified) third-party/benchmark/bindings/python/google_benchmark/__init__.py (+20-38) 
- (modified) third-party/benchmark/bindings/python/google_benchmark/benchmark.cc (+76-73) 
- (modified) third-party/benchmark/bindings/python/google_benchmark/example.py (+4-2) 
- (added) third-party/benchmark/bindings/python/google_benchmark/version.py (+7) 
- (added) third-party/benchmark/bindings/python/nanobind.BUILD (+59) 
- (removed) third-party/benchmark/bindings/python/pybind11.BUILD (-20) 
- (modified) third-party/benchmark/bindings/python/python_headers.BUILD (+4) 
- (removed) third-party/benchmark/bindings/python/requirements.txt (-2) 
- (modified) third-party/benchmark/cmake/CXXFeatureCheck.cmake (+21-8) 
- (modified) third-party/benchmark/cmake/GetGitVersion.cmake (+4-26) 
- (modified) third-party/benchmark/cmake/GoogleTest.cmake (+13-3) 
- (modified) third-party/benchmark/cmake/Modules/FindPFM.cmake (+20-18) 
- (modified) third-party/benchmark/cmake/benchmark.pc.in (+2-2) 
- (added) third-party/benchmark/cmake/pthread_affinity.cpp (+16) 
- (modified) third-party/benchmark/docs/AssemblyTests.md (+2) 
- (modified) third-party/benchmark/docs/_config.yml (+3-1) 
- (added) third-party/benchmark/docs/assets/images/icon.png () 
- (added) third-party/benchmark/docs/assets/images/icon.xcf () 
- (added) third-party/benchmark/docs/assets/images/icon_black.png () 
- (added) third-party/benchmark/docs/assets/images/icon_black.xcf () 
- (modified) third-party/benchmark/docs/dependencies.md (+8-14) 
- (modified) third-party/benchmark/docs/index.md (+3-1) 
- (modified) third-party/benchmark/docs/perf_counters.md (+7-6) 
- (added) third-party/benchmark/docs/python_bindings.md (+34) 
- (added) third-party/benchmark/docs/reducing_variance.md (+98) 
- (modified) third-party/benchmark/docs/releasing.md (+10-14) 
- (modified) third-party/benchmark/docs/tools.md (+140) 
- (modified) third-party/benchmark/docs/user_guide.md (+125-33) 
- (modified) third-party/benchmark/include/benchmark/benchmark.h (+419-144) 
- (added) third-party/benchmark/include/benchmark/export.h (+47) 
- (added) third-party/benchmark/pyproject.toml (+85) 
- (removed) third-party/benchmark/requirements.txt (-3) 
- (modified) third-party/benchmark/setup.py (+85-108) 
- (modified) third-party/benchmark/src/CMakeLists.txt (+23-5) 
- (modified) third-party/benchmark/src/benchmark.cc (+228-61) 
- (modified) third-party/benchmark/src/benchmark_api_internal.cc (+13-7) 
- (modified) third-party/benchmark/src/benchmark_api_internal.h (+3) 
- (modified) third-party/benchmark/src/benchmark_main.cc (+1) 
- (modified) third-party/benchmark/src/benchmark_name.cc (+3-2) 
- (modified) third-party/benchmark/src/benchmark_register.cc (+40-12) 
- (modified) third-party/benchmark/src/benchmark_register.h (+3-2) 
- (modified) third-party/benchmark/src/benchmark_runner.cc (+170-31) 
- (modified) third-party/benchmark/src/benchmark_runner.h (+30-3) 
- (added) third-party/benchmark/src/check.cc (+11) 
- (modified) third-party/benchmark/src/check.h (+27-4) 
- (modified) third-party/benchmark/src/colorprint.cc (+29-17) 
- (modified) third-party/benchmark/src/commandlineflags.cc (+16-3) 
- (modified) third-party/benchmark/src/commandlineflags.h (+28-11) 
- (modified) third-party/benchmark/src/complexity.cc (+29-14) 
- (modified) third-party/benchmark/src/complexity.h (+1-1) 
- (modified) third-party/benchmark/src/console_reporter.cc (+27-7) 
- (modified) third-party/benchmark/src/counter.cc (+2-2) 
- (modified) third-party/benchmark/src/csv_reporter.cc (+17-6) 
- (modified) third-party/benchmark/src/cycleclock.h (+28-12) 
- (modified) third-party/benchmark/src/internal_macros.h (+15-2) 
- (modified) third-party/benchmark/src/json_reporter.cc (+20-16) 
- (modified) third-party/benchmark/src/log.h (+20-6) 
- (modified) third-party/benchmark/src/perf_counters.cc (+196-46) 
- (modified) third-party/benchmark/src/perf_counters.h (+68-40) 
- (modified) third-party/benchmark/src/re.h (+1-1) 
- (modified) third-party/benchmark/src/reporter.cc (+9-5) 
- (removed) third-party/benchmark/src/sleep.cc (-66) 
- (removed) third-party/benchmark/src/sleep.h (-15) 
- (modified) third-party/benchmark/src/statistics.cc (+22-16) 
- (modified) third-party/benchmark/src/statistics.h (+9-3) 
- (modified) third-party/benchmark/src/string_util.cc (+27-38) 
- (modified) third-party/benchmark/src/string_util.h (+8-3) 
- (modified) third-party/benchmark/src/sysinfo.cc (+294-149) 
- (modified) third-party/benchmark/src/thread_manager.h (+2-2) 
- (modified) third-party/benchmark/src/timers.cc (+19-5) 
- (modified) third-party/benchmark/test/AssemblyTests.cmake (+21) 
- (modified) third-party/benchmark/test/CMakeLists.txt (+84-43) 
- (modified) third-party/benchmark/test/args_product_test.cc (+2-2) 
- (modified) third-party/benchmark/test/basic_test.cc (+5-4) 
- (modified) third-party/benchmark/test/benchmark_gtest.cc (+9-5) 
- (added) third-party/benchmark/test/benchmark_min_time_flag_iters_test.cc (+66) 
- (added) third-party/benchmark/test/benchmark_min_time_flag_time_test.cc (+90) 
- (modified) third-party/benchmark/test/benchmark_name_gtest.cc (+8) 
- (modified) third-party/benchmark/test/benchmark_random_interleaving_gtest.cc (+2-3) 
- (modified) third-party/benchmark/test/benchmark_setup_teardown_test.cc (+9-9) 
- (modified) third-party/benchmark/test/benchmark_test.cc (+59-6) 
- (modified) third-party/benchmark/test/clobber_memory_assembly_test.cc (+1) 
- (modified) third-party/benchmark/test/complexity_test.cc (+101-57) 
- (modified) third-party/benchmark/test/diagnostics_test.cc (+13-2) 
- (modified) third-party/benchmark/test/donotoptimize_assembly_test.cc (+40) 
- (modified) third-party/benchmark/test/donotoptimize_test.cc (+22-6) 
- (modified) third-party/benchmark/test/filter_test.cc (+15-16) 
- (modified) third-party/benchmark/test/fixture_test.cc (+3-3) 
- (modified) third-party/benchmark/test/link_main_test.cc (+2-1) 
- (modified) third-party/benchmark/test/map_test.cc (+6-4) 
- (modified) third-party/benchmark/test/memory_manager_test.cc (+6-5) 
- (added) third-party/benchmark/test/min_time_parse_gtest.cc (+30) 
- (modified) third-party/benchmark/test/multiple_ranges_test.cc (+2-2) 
- (modified) third-party/benchmark/test/options_test.cc (+4-2) 
- (modified) third-party/benchmark/test/output_test.h (+5-5) 
- (modified) third-party/benchmark/test/output_test_helper.cc (+25-22) 
- (modified) third-party/benchmark/test/perf_counters_gtest.cc (+214-52) 
- (modified) third-party/benchmark/test/perf_counters_test.cc (+68-3) 
- (modified) third-party/benchmark/test/register_benchmark_test.cc (+19-7) 
- (modified) third-party/benchmark/test/reporter_output_test.cc (+12-6) 
- (modified) third-party/benchmark/test/skip_with_error_test.cc (+10-7) 
- (modified) third-party/benchmark/test/spec_arg_test.cc (+13-3) 
- (added) third-party/benchmark/test/spec_arg_verbosity_test.cc (+43) 
- (modified) third-party/benchmark/test/statistics_gtest.cc (+2-2) 
- (modified) third-party/benchmark/test/string_util_gtest.cc (+51-4) 
- (added) third-party/benchmark/test/time_unit_gtest.cc (+37) 
- (modified) third-party/benchmark/test/user_counters_tabular_test.cc (+7-3) 
- (modified) third-party/benchmark/test/user_counters_test.cc (+17-11) 
- (modified) third-party/benchmark/test/user_counters_thousands_test.cc (+16-16) 
- (modified) third-party/benchmark/tools/compare.py (+42-20) 
- (modified) third-party/benchmark/tools/gbench/Inputs/test1_run1.json (+8) 
- (modified) third-party/benchmark/tools/gbench/Inputs/test1_run2.json (+8) 
- (added) third-party/benchmark/tools/gbench/Inputs/test5_run0.json (+18) 
- (added) third-party/benchmark/tools/gbench/Inputs/test5_run1.json (+18) 
- (modified) third-party/benchmark/tools/gbench/__init__.py (+1-1) 
- (modified) third-party/benchmark/tools/gbench/report.py (+240-31) 
- (modified) third-party/benchmark/tools/gbench/util.py (+43-9) 
- (added) third-party/benchmark/tools/libpfm.BUILD.bazel (+22) 
- (modified) third-party/benchmark/tools/requirements.txt (+2-1) 
- (modified) third-party/benchmark/tools/strip_asm.py (+41-32) 


``````````diff
diff --git a/third-party/benchmark/.pre-commit-config.yaml b/third-party/benchmark/.pre-commit-config.yaml
new file mode 100644
index 00000000000000..0247d1b062b72d
--- /dev/null
+++ b/third-party/benchmark/.pre-commit-config.yaml
@@ -0,0 +1,18 @@
+repos:
+  -   repo: https://github.com/keith/pre-commit-buildifier
+      rev: 6.4.0
+      hooks:
+      -   id: buildifier
+      -   id: buildifier-lint
+  - repo: https://github.com/pre-commit/mirrors-mypy
+    rev: v1.8.0
+    hooks:
+      - id: mypy
+        types_or: [ python, pyi ]
+        args: [ "--ignore-missing-imports", "--scripts-are-modules" ]
+  - repo: https://github.com/astral-sh/ruff-pre-commit
+    rev: v0.1.13
+    hooks:
+      - id: ruff
+        args: [ --fix, --exit-non-zero-on-fix ]
+      - id: ruff-format
\ No newline at end of file
diff --git a/third-party/benchmark/.ycm_extra_conf.py b/third-party/benchmark/.ycm_extra_conf.py
index 1482c7b00202ea..caf257f0540e19 100644
--- a/third-party/benchmark/.ycm_extra_conf.py
+++ b/third-party/benchmark/.ycm_extra_conf.py
@@ -1,4 +1,5 @@
 import os
+
 import ycm_core
 
 # These are the compilation flags that will be used in case there's no
@@ -91,7 +92,9 @@ def GetCompilationInfoForFile(filename):
         for extension in SOURCE_EXTENSIONS:
             replacement_file = basename + extension
             if os.path.exists(replacement_file):
-                compilation_info = database.GetCompilationInfoForFile(replacement_file)
+                compilation_info = database.GetCompilationInfoForFile(
+                    replacement_file
+                )
                 if compilation_info.compiler_flags_:
                     return compilation_info
         return None
@@ -107,7 +110,8 @@ def FlagsForFile(filename, **kwargs):
             return None
 
         final_flags = MakeRelativePathsInFlagsAbsolute(
-            compilation_info.compiler_flags_, compilation_info.compiler_working_dir_
+            compilation_info.compiler_flags_,
+            compilation_info.compiler_working_dir_,
         )
     else:
         relative_to = DirectoryOfThisScript()
diff --git a/third-party/benchmark/AUTHORS b/third-party/benchmark/AUTHORS
index 54770f35499ce3..2170e46fd4a051 100644
--- a/third-party/benchmark/AUTHORS
+++ b/third-party/benchmark/AUTHORS
@@ -13,6 +13,7 @@ Alex Steele <steeleal123 at gmail.com>
 Andriy Berestovskyy <berestovskyy at gmail.com>
 Arne Beer <arne at twobeer.de>
 Carto
+Cezary Skrzyński <czars1988 at gmail.com>
 Christian Wassermann <christian_wassermann at web.de>
 Christopher Seymour <chris.j.seymour at hotmail.com>
 Colin Braley <braley.colin at gmail.com>
@@ -27,10 +28,13 @@ Eric Backus <eric_backus at alum.mit.edu>
 Eric Fiselier <eric at efcs.ca>
 Eugene Zhuk <eugene.zhuk at gmail.com>
 Evgeny Safronov <division494 at gmail.com>
+Fabien Pichot <pichot.fabien at gmail.com>
 Federico Ficarelli <federico.ficarelli at gmail.com>
 Felix Homann <linuxaudio at showlabor.de>
+Gergely Meszaros <maetveis at gmail.com>
 Gergő Szitár <szitar.gergo at gmail.com>
 Google Inc.
+Henrique Bucher <hbucher at gmail.com>
 International Business Machines Corporation
 Ismael Jimenez Martinez <ismael.jimenez.martinez at gmail.com>
 Jern-Kuan Leong <jernkuan at gmail.com>
@@ -41,8 +45,11 @@ Jussi Knuuttila <jussi.knuuttila at gmail.com>
 Kaito Udagawa <umireon at gmail.com>
 Kishan Kumar <kumar.kishan at outlook.com>
 Lei Xu <eddyxu at gmail.com>
+Marcel Jacobse <mjacobse at uni-bremen.de>
 Matt Clarkson <mattyclarkson at gmail.com>
 Maxim Vafin <maxvafin at gmail.com>
+Mike Apodaca <gatorfax at gmail.com>
+Min-Yih Hsu <yihshyng223 at gmail.com>
 MongoDB Inc.
 Nick Hutchinson <nshutchinson at gmail.com>
 Norman Heino <norman.heino at gmail.com>
@@ -50,13 +57,16 @@ Oleksandr Sochka <sasha.sochka at gmail.com>
 Ori Livneh <ori.livneh at gmail.com>
 Paul Redmond <paul.redmond at gmail.com>
 Radoslav Yovchev <radoslav.tm at gmail.com>
+Raghu Raja <raghu at enfabrica.net>
+Rainer Orth <ro at cebitec.uni-bielefeld.de>
 Roman Lebedev <lebedev.ri at gmail.com>
 Sayan Bhattacharjee <aero.sayan at gmail.com>
+Shapr3D <google-contributors at shapr3d.com>
 Shuo Chen <chenshuo at chenshuo.com>
+Staffan Tjernstrom <staffantj at gmail.com>
 Steinar H. Gunderson <sgunderson at bigfoot.com>
 Stripe, Inc.
 Tobias Schmidt <tobias.schmidt at in.tum.de>
 Yixuan Qiu <yixuanq at gmail.com>
 Yusuke Suzuki <utatane.tea at gmail.com>
 Zbigniew Skowron <zbychs at gmail.com>
-Min-Yih Hsu <yihshyng223 at gmail.com>
diff --git a/third-party/benchmark/CMakeLists.txt b/third-party/benchmark/CMakeLists.txt
index 8af49406d052f3..d9bcc6a4939bee 100644
--- a/third-party/benchmark/CMakeLists.txt
+++ b/third-party/benchmark/CMakeLists.txt
@@ -1,19 +1,7 @@
-cmake_minimum_required (VERSION 3.5.1)
-
-foreach(p
-    CMP0048 # OK to clear PROJECT_VERSION on project()
-    CMP0054 # CMake 3.1
-    CMP0056 # export EXE_LINKER_FLAGS to try_run
-    CMP0057 # Support no if() IN_LIST operator
-    CMP0063 # Honor visibility properties for all targets
-    CMP0077 # Allow option() overrides in importing projects
-    )
-  if(POLICY ${p})
-    cmake_policy(SET ${p} NEW)
-  endif()
-endforeach()
+# Require CMake 3.10. If available, use the policies up to CMake 3.22.
+cmake_minimum_required (VERSION 3.10...3.22)
 
-project (benchmark VERSION 1.6.0 LANGUAGES CXX)
+project (benchmark VERSION 1.8.3 LANGUAGES CXX)
 
 option(BENCHMARK_ENABLE_TESTING "Enable testing of the benchmark library." ON)
 option(BENCHMARK_ENABLE_EXCEPTIONS "Enable the use of exceptions in the benchmark library." ON)
@@ -26,11 +14,14 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "PGI")
   # PGC++ maybe reporting false positives.
   set(BENCHMARK_ENABLE_WERROR OFF)
 endif()
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "NVHPC")
+  set(BENCHMARK_ENABLE_WERROR OFF)
+endif()
 if(BENCHMARK_FORCE_WERROR)
   set(BENCHMARK_ENABLE_WERROR ON)
 endif(BENCHMARK_FORCE_WERROR)
 
-if(NOT MSVC)
+if(NOT (MSVC OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC"))
   option(BENCHMARK_BUILD_32_BITS "Build a 32 bit version of the library." OFF)
 else()
   set(BENCHMARK_BUILD_32_BITS OFF CACHE BOOL "Build a 32 bit version of the library - unsupported when using MSVC)" FORCE)
@@ -50,8 +41,11 @@ option(BENCHMARK_USE_BUNDLED_GTEST "Use bundled GoogleTest. If disabled, the fin
 
 option(BENCHMARK_ENABLE_LIBPFM "Enable performance counters provided by libpfm" OFF)
 
-set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
-if(MSVC)
+# Export only public symbols
+set(CMAKE_CXX_VISIBILITY_PRESET hidden)
+set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
+
+if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
     # As of CMake 3.18, CMAKE_SYSTEM_PROCESSOR is not set properly for MSVC and
     # cross-compilation (e.g. Host=x86_64, target=aarch64) requires using the
     # undocumented, but working variable.
@@ -72,7 +66,7 @@ function(should_enable_assembly_tests)
       return()
     endif()
   endif()
-  if (MSVC)
+  if (MSVC OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
     return()
   elseif(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
     return()
@@ -111,22 +105,32 @@ get_git_version(GIT_VERSION)
 # If no git version can be determined, use the version
 # from the project() command
 if ("${GIT_VERSION}" STREQUAL "0.0.0")
-  set(VERSION "${benchmark_VERSION}")
+  set(VERSION "v${benchmark_VERSION}")
 else()
   set(VERSION "${GIT_VERSION}")
 endif()
+
+# Normalize version: drop "v" prefix, replace first "-" with ".",
+# drop everything after second "-" (including said "-").
+string(STRIP ${VERSION} VERSION)
+if(VERSION MATCHES v[^-]*-)
+   string(REGEX REPLACE "v([^-]*)-([0-9]+)-.*" "\\1.\\2"  NORMALIZED_VERSION ${VERSION})
+else()
+   string(REGEX REPLACE "v(.*)" "\\1" NORMALIZED_VERSION ${VERSION})
+endif()
+
 # Tell the user what versions we are using
-message(STATUS "Version: ${VERSION}")
+message(STATUS "Google Benchmark version: ${VERSION}, normalized to ${NORMALIZED_VERSION}")
 
 # The version of the libraries
-set(GENERIC_LIB_VERSION ${VERSION})
-string(SUBSTRING ${VERSION} 0 1 GENERIC_LIB_SOVERSION)
+set(GENERIC_LIB_VERSION ${NORMALIZED_VERSION})
+string(SUBSTRING ${NORMALIZED_VERSION} 0 1 GENERIC_LIB_SOVERSION)
 
 # Import our CMake modules
-include(CheckCXXCompilerFlag)
 include(AddCXXCompilerFlag)
-include(CXXFeatureCheck)
+include(CheckCXXCompilerFlag)
 include(CheckLibraryExists)
+include(CXXFeatureCheck)
 
 check_library_exists(rt shm_open "" HAVE_LIB_RT)
 
@@ -134,6 +138,16 @@ if (BENCHMARK_BUILD_32_BITS)
   add_required_cxx_compiler_flag(-m32)
 endif()
 
+if (MSVC OR CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
+  set(BENCHMARK_CXX_STANDARD 14)
+else()
+  set(BENCHMARK_CXX_STANDARD 11)
+endif()
+
+set(CMAKE_CXX_STANDARD ${BENCHMARK_CXX_STANDARD})
+set(CMAKE_CXX_STANDARD_REQUIRED YES)
+set(CMAKE_CXX_EXTENSIONS OFF)
+
 if (MSVC)
   # Turn compiler warnings up to 11
   string(REGEX REPLACE "[-/]W[1-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
@@ -166,21 +180,18 @@ if (MSVC)
     set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} /LTCG")
   endif()
 else()
-  # Try and enable C++11. Don't use C++14 because it doesn't work in some
-  # configurations.
-  add_cxx_compiler_flag(-std=c++11)
-  if (NOT HAVE_CXX_FLAG_STD_CXX11)
-    add_cxx_compiler_flag(-std=c++0x)
-  endif()
-
+  # Turn on Large-file Support
+  add_definitions(-D_FILE_OFFSET_BITS=64)
+  add_definitions(-D_LARGEFILE64_SOURCE)
+  add_definitions(-D_LARGEFILE_SOURCE)
   # Turn compiler warnings up to 11
   add_cxx_compiler_flag(-Wall)
   add_cxx_compiler_flag(-Wextra)
   add_cxx_compiler_flag(-Wshadow)
+  add_cxx_compiler_flag(-Wfloat-equal)
+  add_cxx_compiler_flag(-Wold-style-cast)
   if(BENCHMARK_ENABLE_WERROR)
-      add_cxx_compiler_flag(-Werror RELEASE)
-      add_cxx_compiler_flag(-Werror RELWITHDEBINFO)
-      add_cxx_compiler_flag(-Werror MINSIZEREL)
+      add_cxx_compiler_flag(-Werror)
   endif()
   if (NOT BENCHMARK_ENABLE_TESTING)
     # Disable warning when compiling tests as gtest does not use 'override'.
@@ -193,24 +204,23 @@ else()
   # Disable warnings regarding deprecated parts of the library while building
   # and testing those parts of the library.
   add_cxx_compiler_flag(-Wno-deprecated-declarations)
-  if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
+  if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel" OR CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM")
     # Intel silently ignores '-Wno-deprecated-declarations',
     # warning no. 1786 must be explicitly disabled.
     # See #631 for rationale.
     add_cxx_compiler_flag(-wd1786)
+    add_cxx_compiler_flag(-fno-finite-math-only)
   endif()
   # Disable deprecation warnings for release builds (when -Werror is enabled).
   if(BENCHMARK_ENABLE_WERROR)
-      add_cxx_compiler_flag(-Wno-deprecated RELEASE)
-      add_cxx_compiler_flag(-Wno-deprecated RELWITHDEBINFO)
-      add_cxx_compiler_flag(-Wno-deprecated MINSIZEREL)
+      add_cxx_compiler_flag(-Wno-deprecated)
   endif()
   if (NOT BENCHMARK_ENABLE_EXCEPTIONS)
     add_cxx_compiler_flag(-fno-exceptions)
   endif()
 
   if (HAVE_CXX_FLAG_FSTRICT_ALIASING)
-    if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel") #ICC17u2: Many false positives for Wstrict-aliasing
+    if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") #ICC17u2: Many false positives for Wstrict-aliasing
       add_cxx_compiler_flag(-Wstrict-aliasing)
     endif()
   endif()
@@ -219,12 +229,12 @@ else()
   add_cxx_compiler_flag(-wd654)
   add_cxx_compiler_flag(-Wthread-safety)
   if (HAVE_CXX_FLAG_WTHREAD_SAFETY)
-    cxx_feature_check(THREAD_SAFETY_ATTRIBUTES)
+    cxx_feature_check(THREAD_SAFETY_ATTRIBUTES "-DINCLUDE_DIRECTORIES=${PROJECT_SOURCE_DIR}/include")
   endif()
 
   # On most UNIX like platforms g++ and clang++ define _GNU_SOURCE as a
   # predefined macro, which turns on all of the wonderful libc extensions.
-  # However g++ doesn't do this in Cygwin so we have to define it ourselfs
+  # However g++ doesn't do this in Cygwin so we have to define it ourselves
   # since we depend on GNU/POSIX/BSD extensions.
   if (CYGWIN)
     add_definitions(-D_GNU_SOURCE=1)
@@ -275,7 +285,8 @@ if (BENCHMARK_USE_LIBCXX)
   if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
     add_cxx_compiler_flag(-stdlib=libc++)
   elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR
-          "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
+          "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" OR
+          "${CMAKE_CXX_COMPILER_ID}" STREQUAL "IntelLLVM")
     add_cxx_compiler_flag(-nostdinc++)
     message(WARNING "libc++ header path must be manually specified using CMAKE_CXX_FLAGS")
     # Adding -nodefaultlibs directly to CMAKE_<TYPE>_LINKER_FLAGS will break
@@ -312,9 +323,10 @@ cxx_feature_check(STEADY_CLOCK)
 # Ensure we have pthreads
 set(THREADS_PREFER_PTHREAD_FLAG ON)
 find_package(Threads REQUIRED)
+cxx_feature_check(PTHREAD_AFFINITY)
 
 if (BENCHMARK_ENABLE_LIBPFM)
-  find_package(PFM)
+  find_package(PFM REQUIRED)
 endif()
 
 # Set up directories
diff --git a/third-party/benchmark/CONTRIBUTORS b/third-party/benchmark/CONTRIBUTORS
index 651fbeafe66ab7..9ca2caa3ee784a 100644
--- a/third-party/benchmark/CONTRIBUTORS
+++ b/third-party/benchmark/CONTRIBUTORS
@@ -27,7 +27,9 @@ Albert Pretorius <pretoalb at gmail.com>
 Alex Steele <steelal123 at gmail.com>
 Andriy Berestovskyy <berestovskyy at gmail.com>
 Arne Beer <arne at twobeer.de>
+Bátor Tallér <bator.taller at shapr3d.com>
 Billy Robert O'Neal III <billy.oneal at gmail.com> <bion at microsoft.com>
+Cezary Skrzyński <czars1988 at gmail.com>
 Chris Kennelly <ckennelly at google.com> <ckennelly at ckennelly.com>
 Christian Wassermann <christian_wassermann at web.de>
 Christopher Seymour <chris.j.seymour at hotmail.com>
@@ -44,25 +46,32 @@ Eric Backus <eric_backus at alum.mit.edu>
 Eric Fiselier <eric at efcs.ca>
 Eugene Zhuk <eugene.zhuk at gmail.com>
 Evgeny Safronov <division494 at gmail.com>
+Fabien Pichot <pichot.fabien at gmail.com>
 Fanbo Meng <fanbo.meng at ibm.com>
 Federico Ficarelli <federico.ficarelli at gmail.com>
 Felix Homann <linuxaudio at showlabor.de>
 Geoffrey Martin-Noble <gcmn at google.com> <gmngeoffrey at gmail.com>
+Gergely Meszaros <maetveis at gmail.com>
 Gergő Szitár <szitar.gergo at gmail.com>
 Hannes Hauswedell <h2 at fsfe.org>
+Henrique Bucher <hbucher at gmail.com>
 Ismael Jimenez Martinez <ismael.jimenez.martinez at gmail.com>
+Iakov Sergeev <yahontu at gmail.com>
 Jern-Kuan Leong <jernkuan at gmail.com>
 JianXiong Zhou <zhoujianxiong2 at gmail.com>
 Joao Paulo Magalhaes <joaoppmagalhaes at gmail.com>
 John Millikin <jmillikin at stripe.com>
 Jordan Williams <jwillikers at protonmail.com>
 Jussi Knuuttila <jussi.knuuttila at gmail.com>
-Kai Wolf <kai.wolf at gmail.com>
 Kaito Udagawa <umireon at gmail.com>
+Kai Wolf <kai.wolf at gmail.com>
 Kishan Kumar <kumar.kishan at outlook.com>
 Lei Xu <eddyxu at gmail.com>
+Marcel Jacobse <mjacobse at uni-bremen.de>
 Matt Clarkson <mattyclarkson at gmail.com>
 Maxim Vafin <maxvafin at gmail.com>
+Mike Apodaca <gatorfax at gmail.com>
+Min-Yih Hsu <yihshyng223 at gmail.com>
 Nick Hutchinson <nshutchinson at gmail.com>
 Norman Heino <norman.heino at gmail.com>
 Oleksandr Sochka <sasha.sochka at gmail.com>
@@ -71,6 +80,8 @@ Pascal Leroy <phl at google.com>
 Paul Redmond <paul.redmond at gmail.com>
 Pierre Phaneuf <pphaneuf at google.com>
 Radoslav Yovchev <radoslav.tm at gmail.com>
+Raghu Raja <raghu at enfabrica.net>
+Rainer Orth <ro at cebitec.uni-bielefeld.de>
 Raul Marin <rmrodriguez at cartodb.com>
 Ray Glover <ray.glover at uk.ibm.com>
 Robert Guo <robert.guo at mongodb.com>
@@ -84,4 +95,3 @@ Tom Madams <tom.ej.madams at gmail.com> <tmadams at google.com>
 Yixuan Qiu <yixuanq at gmail.com>
 Yusuke Suzuki <utatane.tea at gmail.com>
 Zbigniew Skowron <zbychs at gmail.com>
-Min-Yih Hsu <yihshyng223 at gmail.com>
diff --git a/third-party/benchmark/MODULE.bazel b/third-party/benchmark/MODULE.bazel
new file mode 100644
index 00000000000000..7e0e0161235b47
--- /dev/null
+++ b/third-party/benchmark/MODULE.bazel
@@ -0,0 +1,32 @@
+module(
+    name = "google_benchmark",
+    version = "1.8.3",
+)
+
+bazel_dep(name = "bazel_skylib", version = "1.5.0")
+bazel_dep(name = "platforms", version = "0.0.7")
+bazel_dep(name = "rules_foreign_cc", version = "0.10.1")
+bazel_dep(name = "rules_cc", version = "0.0.9")
+
+bazel_dep(name = "rules_python", version = "0.27.1", dev_dependency = True)
+bazel_dep(name = "googletest", version = "1.12.1", dev_dependency = True, repo_name = "com_google_googletest")
+
+bazel_dep(name = "libpfm", version = "4.11.0")
+
+# Register a toolchain for Python 3.9 to be able to build numpy. Python
+# versions >=3.10 are problematic.
+# A second reason for this is to be able to build Python hermetically instead
+# of relying on the changing default version from rules_python.
+
+python = use_extension("@rules_python//python/extensions:python.bzl", "python", dev_dependency = True)
+python.toolchain(python_version = "3.9")
+
+pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_dependency = True)
+pip.parse(
+    hub_name = "tools_pip_deps",
+    python_version = "3.9",
+    requirements_lock = "//tools:requirements.txt",
+)
+use_repo(pip, "tools_pip_deps")
+
+# -- bazel_dep definitions -- #
diff --git a/third-party/benchmark/README.md b/third-party/benchmark/README.md
index 7b81d960fc1d72..a5e5d392d8262d 100644
--- a/third-party/benchmark/README.md
+++ b/third-party/benchmark/README.md
@@ -4,10 +4,9 @@
 [![bazel](https://github.com/google/benchmark/actions/workflows/bazel.yml/badge.svg)](https://github.com/google/benchmark/actions/workflows/bazel.yml)
 [![pylint](https://github.com/google/benchmark/workflows/pylint/badge.svg)](https://github.com/google/benchmark/actions?query=workflow%3Apylint)
 [![test-bindings](https://github.com/google/benchmark/workflows/test-bindings/badge.svg)](https://github.com/google/benchmark/actions?query=workflow%3Atest-bindings)
-
-[![Build Status](https://travis-ci.org/google/benchmark.svg?branch=master)](https://travis-ci.org/google/benchmark)
 [![Coverage Status](https://coveralls.io/repos/google/benchmark/badge.svg)](https://coveralls.io/r/google/benchmark)
 
+[![Discord](https://discordapp.com/api/guilds/1125694995928719494/widget.png?style=shield)](https://discord.gg/cz7UX7wKC2)
 
 A library to benchmark code snippets, similar to unit tests. Example:
 
@@ -33,7 +32,7 @@ To get started, see [Requirements](#requirements) and
 [Installation](#installation). See [Usage](#usage) for a full example and the
 [User Guide](docs/user_guide.md) for a more comprehensive feature overview.
 
-It may also help to read the [Google Test documentation](https://github.com/google/googletest/blob/master/docs/primer.md)
+It may also help to read the [Google Test documentation](https://github.com/google/googletest/blob/main/docs/primer.md)
 as some of the structural aspects of the APIs are similar.
 
 ## Resources
@@ -47,6 +46,8 @@ IRC channels:
 
 [Assembly Testing Documentation](docs/AssemblyTests.md)
 
+[Building and installing Python bindings](docs/python_bindings.md)
+
 ## Requirements
 
 The library can be used with C++03. However, it requires C++11 to build,
@@ -137,6 +138,12 @@ cache variables, if autodetection fails.
 If you are using clang, you may need to set `LLVMAR_EXECUTABLE`,
 `LLVMNM_EXECUTABLE` and `LLVMRANLIB_EXECUTABLE` cmake cache variables.
 
+To enable sanitizer checks (eg., `asan` and `tsan`), add:
+```
+ -DCMAKE_C_FLAGS="-g -O2 -fno-omit-frame-pointer -fsanitize=address -fsanitize=thread -fno-sanitize-recover=all"
+ -DCMAKE_CXX_FLAGS="-g -O2 -fno-omit-frame-pointer -fsanitize=address -fsanitize=thread -fno-sanitize-recover=all "  
+```
+
 ### Stable and Experimental Library Versions
 
 The main branch contains the latest stable version of the benchmarking library;
diff --git a/third-party/benchmark/WORKSPACE b/third-party/benchmark/WORKSPACE
index 949eb98bc5d9de..256207022597f5 100644
--- a/third-party/benchmark/WORKSPACE
+++ b/third-party/benchmark/WORKSPACE
@@ -1,44 +1,30 @@
 workspace(name = "com_github_google_benchmark")
 
-load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
-load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
-
-http_archive(
-    name = "com_google_absl",
-    sha256 = "f41868f7a938605c92936230081175d1eae87f6ea2c248f41077c8f88316f111",
-    strip_prefix = "abseil-cpp-20200225.2",
-    urls = ["https://github.com/abseil/abseil-cpp/archive/20200225.2.tar.gz"],
-)
+load("//:bazel/benchmark_deps.bzl", "benchmark_deps")
 
-git_repository(
-    name = "com_google_googletest",
-    remote = "https://github.com/google/googletest.git",
-    tag = "release-1.11.0",
-)
+benchmark_deps()
 
-http_archive(
-    name = "pybind11",
-    build_file = "@//bindings/python:pybind11.BUILD",
-    sha256 = "1eed57bc6863190e35637290f97a20...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/83916


More information about the llvm-commits mailing list