Skip to content

[ADT] Simplify countr_zero and countl_zero with constexpr if (NFC) #141517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

kazutakahirata
Copy link
Contributor

The high-level idea in countr_zero and countl_zero is to use the
intrinsic if available and fall back otherwise, but the actual
implementation is unnecessarily complicated.

Specifically, without this patch, we are going through a long chain of
macros to check the availability of _BitScanForward64:

#if defined(GNUC) || defined(_MSC_VER)
#if !defined(_MSC_VER) || defined(_M_X64)
#if __has_builtin(__builtin_ctzll) || defined(GNUC)
...
#elif defined(_MSC_VER)
_BitScanForward64(...);
#endif
#endif
#endif

This basically says we can use _BitScanForward64 if:

defined(_MSC_VER) && defined(_M_X64)

This patch simplifies all this with "constexpr if" and consolidates
the implementation into the body of countr_zero and countl_zero.

The high-level idea in countr_zero and countl_zero is to use the
intrinsic if available and fall back otherwise, but the actual
implementation is unnecessarily complicated.

Specifically, without this patch, we are going through a long chain of
macros to check the availability of _BitScanForward64:

  #if defined(__GNUC__) || defined(_MSC_VER)
    #if !defined(_MSC_VER) || defined(_M_X64)
      #if __has_builtin(__builtin_ctzll) || defined(__GNUC__)
        ...
      #elif defined(_MSC_VER)
        _BitScanForward64(...);
      #endif
    #endif
  #endif

This basically says we can use _BitScanForward64 if:

  defined(_MSC_VER) && defined(_M_X64)

This patch simplifies all this with "constexpr if" and consolidates
the implementation into the body of countr_zero and countl_zero.
@llvmbot
Copy link
Member

llvmbot commented May 26, 2025

@llvm/pr-subscribers-llvm-adt

Author: Kazu Hirata (kazutakahirata)

Changes

The high-level idea in countr_zero and countl_zero is to use the
intrinsic if available and fall back otherwise, but the actual
implementation is unnecessarily complicated.

Specifically, without this patch, we are going through a long chain of
macros to check the availability of _BitScanForward64:

#if defined(GNUC) || defined(_MSC_VER)
#if !defined(_MSC_VER) || defined(_M_X64)
#if __has_builtin(__builtin_ctzll) || defined(GNUC)
...
#elif defined(_MSC_VER)
_BitScanForward64(...);
#endif
#endif
#endif

This basically says we can use _BitScanForward64 if:

defined(_MSC_VER) && defined(_M_X64)

This patch simplifies all this with "constexpr if" and consolidates
the implementation into the body of countr_zero and countl_zero.


Full diff: https://github.com/llvm/llvm-project/pull/141517.diff

1 Files Affected:

  • (modified) llvm/include/llvm/ADT/bit.h (+48-96)
diff --git a/llvm/include/llvm/ADT/bit.h b/llvm/include/llvm/ADT/bit.h
index 8544efb5c45d4..b952825e574bc 100644
--- a/llvm/include/llvm/ADT/bit.h
+++ b/llvm/include/llvm/ADT/bit.h
@@ -148,36 +148,20 @@ template <typename T, typename = std::enable_if_t<std::is_unsigned_v<T>>>
   return (Value != 0) && ((Value & (Value - 1)) == 0);
 }
 
-namespace detail {
-template <typename T, std::size_t SizeOfT> struct TrailingZerosCounter {
-  static unsigned count(T Val) {
-    if (!Val)
-      return std::numeric_limits<T>::digits;
-    if (Val & 0x1)
-      return 0;
-
-    // Bisection method.
-    unsigned ZeroBits = 0;
-    T Shift = std::numeric_limits<T>::digits >> 1;
-    T Mask = std::numeric_limits<T>::max() >> Shift;
-    while (Shift) {
-      if ((Val & Mask) == 0) {
-        Val >>= Shift;
-        ZeroBits |= Shift;
-      }
-      Shift >>= 1;
-      Mask >>= Shift;
-    }
-    return ZeroBits;
-  }
-};
-
-#if defined(__GNUC__) || defined(_MSC_VER)
-template <typename T> struct TrailingZerosCounter<T, 4> {
-  static unsigned count(T Val) {
-    if (Val == 0)
-      return 32;
+/// Count number of 0's from the least significant bit to the most
+///   stopping at the first 1.
+///
+/// Only unsigned integral types are allowed.
+///
+/// Returns std::numeric_limits<T>::digits on an input of 0.
+template <typename T> [[nodiscard]] int countr_zero(T Val) {
+  static_assert(std::is_unsigned_v<T>,
+                "Only unsigned integral types are allowed.");
+  if (!Val)
+    return std::numeric_limits<T>::digits;
 
+  // Use the intrinsic if available.
+  if constexpr (sizeof(T) == 4) {
 #if __has_builtin(__builtin_ctz) || defined(__GNUC__)
     return __builtin_ctz(Val);
 #elif defined(_MSC_VER)
@@ -185,65 +169,45 @@ template <typename T> struct TrailingZerosCounter<T, 4> {
     _BitScanForward(&Index, Val);
     return Index;
 #endif
-  }
-};
-
-#if !defined(_MSC_VER) || defined(_M_X64)
-template <typename T> struct TrailingZerosCounter<T, 8> {
-  static unsigned count(T Val) {
-    if (Val == 0)
-      return 64;
-
+  } else if constexpr (sizeof(T) == 8) {
 #if __has_builtin(__builtin_ctzll) || defined(__GNUC__)
     return __builtin_ctzll(Val);
-#elif defined(_MSC_VER)
+#elif defined(_MSC_VER) && defined(_M_X64)
     unsigned long Index;
     _BitScanForward64(&Index, Val);
     return Index;
 #endif
   }
-};
-#endif
-#endif
-} // namespace detail
 
-/// Count number of 0's from the least significant bit to the most
+  // Fall back to the bisection method.
+  unsigned ZeroBits = 0;
+  T Shift = std::numeric_limits<T>::digits >> 1;
+  T Mask = std::numeric_limits<T>::max() >> Shift;
+  while (Shift) {
+    if ((Val & Mask) == 0) {
+      Val >>= Shift;
+      ZeroBits |= Shift;
+    }
+    Shift >>= 1;
+    Mask >>= Shift;
+  }
+  return ZeroBits;
+}
+
+/// Count number of 0's from the most significant bit to the least
 ///   stopping at the first 1.
 ///
 /// Only unsigned integral types are allowed.
 ///
 /// Returns std::numeric_limits<T>::digits on an input of 0.
-template <typename T> [[nodiscard]] int countr_zero(T Val) {
+template <typename T> [[nodiscard]] int countl_zero(T Val) {
   static_assert(std::is_unsigned_v<T>,
                 "Only unsigned integral types are allowed.");
-  return llvm::detail::TrailingZerosCounter<T, sizeof(T)>::count(Val);
-}
-
-namespace detail {
-template <typename T, std::size_t SizeOfT> struct LeadingZerosCounter {
-  static unsigned count(T Val) {
-    if (!Val)
-      return std::numeric_limits<T>::digits;
-
-    // Bisection method.
-    unsigned ZeroBits = 0;
-    for (T Shift = std::numeric_limits<T>::digits >> 1; Shift; Shift >>= 1) {
-      T Tmp = Val >> Shift;
-      if (Tmp)
-        Val = Tmp;
-      else
-        ZeroBits |= Shift;
-    }
-    return ZeroBits;
-  }
-};
-
-#if defined(__GNUC__) || defined(_MSC_VER)
-template <typename T> struct LeadingZerosCounter<T, 4> {
-  static unsigned count(T Val) {
-    if (Val == 0)
-      return 32;
+  if (!Val)
+    return std::numeric_limits<T>::digits;
 
+  // Use the intrinsic if available.
+  if constexpr (sizeof(T) == 4) {
 #if __has_builtin(__builtin_clz) || defined(__GNUC__)
     return __builtin_clz(Val);
 #elif defined(_MSC_VER)
@@ -251,38 +215,26 @@ template <typename T> struct LeadingZerosCounter<T, 4> {
     _BitScanReverse(&Index, Val);
     return Index ^ 31;
 #endif
-  }
-};
-
-#if !defined(_MSC_VER) || defined(_M_X64)
-template <typename T> struct LeadingZerosCounter<T, 8> {
-  static unsigned count(T Val) {
-    if (Val == 0)
-      return 64;
-
+  } else if constexpr (sizeof(T) == 8) {
 #if __has_builtin(__builtin_clzll) || defined(__GNUC__)
     return __builtin_clzll(Val);
-#elif defined(_MSC_VER)
+#elif defined(_MSC_VER) && defined(_M_X64)
     unsigned long Index;
     _BitScanReverse64(&Index, Val);
     return Index ^ 63;
 #endif
   }
-};
-#endif
-#endif
-} // namespace detail
 
-/// Count number of 0's from the most significant bit to the least
-///   stopping at the first 1.
-///
-/// Only unsigned integral types are allowed.
-///
-/// Returns std::numeric_limits<T>::digits on an input of 0.
-template <typename T> [[nodiscard]] int countl_zero(T Val) {
-  static_assert(std::is_unsigned_v<T>,
-                "Only unsigned integral types are allowed.");
-  return llvm::detail::LeadingZerosCounter<T, sizeof(T)>::count(Val);
+  // Fall back to the bisection method.
+  unsigned ZeroBits = 0;
+  for (T Shift = std::numeric_limits<T>::digits >> 1; Shift; Shift >>= 1) {
+    T Tmp = Val >> Shift;
+    if (Tmp)
+      Val = Tmp;
+    else
+      ZeroBits |= Shift;
+  }
+  return ZeroBits;
 }
 
 /// Count the number of ones from the most significant bit to the first

@kazutakahirata kazutakahirata requested a review from nikic May 31, 2025 22:09
@kazutakahirata kazutakahirata changed the title [ADT] Simplify countr_zero and countl_zero (NFC) [ADT] Simplify countr_zero and countl_zero with constexpr if (NFC) May 31, 2025
@kazutakahirata kazutakahirata merged commit 32c7dc0 into llvm:main Jun 2, 2025
13 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250526_countr_zero branch June 2, 2025 06:23
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 2, 2025

LLVM Buildbot has detected a new failure on builder clang-riscv-rva20-2stage running on rise-clang-riscv-rva20-2stage while building llvm at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/87/builds/1632

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/rise-riscv-build.sh --jobs=32' (failure)
...
PASS: lit :: shtest-format.py (81553 of 84683)
PASS: lit :: unparsed-requirements.py (81554 of 84683)
PASS: lit :: test-output-micro-resultdb.py (81555 of 84683)
PASS: lit :: shtest-pushd-popd.py (81556 of 84683)
PASS: lit :: shtest-cat.py (81557 of 84683)
PASS: lit :: unittest-adaptor.py (81558 of 84683)
PASS: lit :: test-output-micro.py (81559 of 84683)
PASS: lit :: test-output.py (81560 of 84683)
PASS: lld :: COFF/alias-implib.s (81561 of 84683)
PASS: lit :: show-result-codes.py (81562 of 84683)
FAIL: lit :: timeout-hang.py (81563 of 84683)
******************** TEST 'lit :: timeout-hang.py' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 13
not env -u FILECHECK_OPTS "/usr/bin/python3" /home/buildbot-worker/bbroot/clang-riscv-rva20-2stage/llvm/llvm/utils/lit/lit.py -j1 --order=lexical Inputs/timeout-hang/run-nonexistent.txt  --timeout=1 --param external=0 | "/usr/bin/python3" /home/buildbot-worker/bbroot/clang-riscv-rva20-2stage/stage2/utils/lit/tests/timeout-hang.py 1
# executed command: not env -u FILECHECK_OPTS /usr/bin/python3 /home/buildbot-worker/bbroot/clang-riscv-rva20-2stage/llvm/llvm/utils/lit/lit.py -j1 --order=lexical Inputs/timeout-hang/run-nonexistent.txt --timeout=1 --param external=0
# .---command stderr------------
# | lit.py: /home/buildbot-worker/bbroot/clang-riscv-rva20-2stage/llvm/llvm/utils/lit/lit/main.py:73: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 1 seconds was requested on the command line. Forcing timeout to be 1 seconds.
# `-----------------------------
# executed command: /usr/bin/python3 /home/buildbot-worker/bbroot/clang-riscv-rva20-2stage/stage2/utils/lit/tests/timeout-hang.py 1
# .---command stdout------------
# | Testing took as long or longer than timeout
# `-----------------------------
# error: command failed with exit status: 1

--

********************
PASS: LLVM-Unit :: Support/./SupportTests/10/48 (81564 of 84683)
PASS: lld :: COFF/arm-thumb-branch20-error.s (81565 of 84683)
PASS: lld :: COFF/ar-comdat.test (81566 of 84683)
PASS: lld :: COFF/allow-unknown-debug-info.test (81567 of 84683)
PASS: lld :: COFF/alternatename.test (81568 of 84683)
PASS: lit :: shtest-inject.py (81569 of 84683)
PASS: lld :: COFF/arm64-delayimport.yaml (81570 of 84683)
PASS: lld :: COFF/align.s (81571 of 84683)
PASS: lld :: COFF/arm-thumb-thunks.s (81572 of 84683)
PASS: lld :: COFF/arm64-import2.test (81573 of 84683)
PASS: lld :: COFF/arm-thumb-thunks-multipass.s (81574 of 84683)
PASS: lld :: COFF/arm-thumb-thunks-pdb.s (81575 of 84683)
PASS: lld :: COFF/arm64-localimport-align.s (81576 of 84683)
PASS: lld :: COFF/arm64-magic.yaml (81577 of 84683)
PASS: lld :: COFF/arm64-dynamicbase.s (81578 of 84683)
PASS: lit :: usage.py (81579 of 84683)
PASS: lit :: xunit-output-report-failures-only.py (81580 of 84683)
PASS: lld :: COFF/arm64-relocs-imports.test (81581 of 84683)
Step 11 (llvm-project check-all) failure: llvm-project check-all (failure)
...
PASS: lit :: shtest-format.py (81553 of 84683)
PASS: lit :: unparsed-requirements.py (81554 of 84683)
PASS: lit :: test-output-micro-resultdb.py (81555 of 84683)
PASS: lit :: shtest-pushd-popd.py (81556 of 84683)
PASS: lit :: shtest-cat.py (81557 of 84683)
PASS: lit :: unittest-adaptor.py (81558 of 84683)
PASS: lit :: test-output-micro.py (81559 of 84683)
PASS: lit :: test-output.py (81560 of 84683)
PASS: lld :: COFF/alias-implib.s (81561 of 84683)
PASS: lit :: show-result-codes.py (81562 of 84683)
FAIL: lit :: timeout-hang.py (81563 of 84683)
******************** TEST 'lit :: timeout-hang.py' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 13
not env -u FILECHECK_OPTS "/usr/bin/python3" /home/buildbot-worker/bbroot/clang-riscv-rva20-2stage/llvm/llvm/utils/lit/lit.py -j1 --order=lexical Inputs/timeout-hang/run-nonexistent.txt  --timeout=1 --param external=0 | "/usr/bin/python3" /home/buildbot-worker/bbroot/clang-riscv-rva20-2stage/stage2/utils/lit/tests/timeout-hang.py 1
# executed command: not env -u FILECHECK_OPTS /usr/bin/python3 /home/buildbot-worker/bbroot/clang-riscv-rva20-2stage/llvm/llvm/utils/lit/lit.py -j1 --order=lexical Inputs/timeout-hang/run-nonexistent.txt --timeout=1 --param external=0
# .---command stderr------------
# | lit.py: /home/buildbot-worker/bbroot/clang-riscv-rva20-2stage/llvm/llvm/utils/lit/lit/main.py:73: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 1 seconds was requested on the command line. Forcing timeout to be 1 seconds.
# `-----------------------------
# executed command: /usr/bin/python3 /home/buildbot-worker/bbroot/clang-riscv-rva20-2stage/stage2/utils/lit/tests/timeout-hang.py 1
# .---command stdout------------
# | Testing took as long or longer than timeout
# `-----------------------------
# error: command failed with exit status: 1

--

********************
PASS: LLVM-Unit :: Support/./SupportTests/10/48 (81564 of 84683)
PASS: lld :: COFF/arm-thumb-branch20-error.s (81565 of 84683)
PASS: lld :: COFF/ar-comdat.test (81566 of 84683)
PASS: lld :: COFF/allow-unknown-debug-info.test (81567 of 84683)
PASS: lld :: COFF/alternatename.test (81568 of 84683)
PASS: lit :: shtest-inject.py (81569 of 84683)
PASS: lld :: COFF/arm64-delayimport.yaml (81570 of 84683)
PASS: lld :: COFF/align.s (81571 of 84683)
PASS: lld :: COFF/arm-thumb-thunks.s (81572 of 84683)
PASS: lld :: COFF/arm64-import2.test (81573 of 84683)
PASS: lld :: COFF/arm-thumb-thunks-multipass.s (81574 of 84683)
PASS: lld :: COFF/arm-thumb-thunks-pdb.s (81575 of 84683)
PASS: lld :: COFF/arm64-localimport-align.s (81576 of 84683)
PASS: lld :: COFF/arm64-magic.yaml (81577 of 84683)
PASS: lld :: COFF/arm64-dynamicbase.s (81578 of 84683)
PASS: lit :: usage.py (81579 of 84683)
PASS: lit :: xunit-output-report-failures-only.py (81580 of 84683)
PASS: lld :: COFF/arm64-relocs-imports.test (81581 of 84683)

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jun 2, 2025

LLVM Buildbot has detected a new failure on builder sanitizer-x86_64-linux-bootstrap-asan running on sanitizer-buildbot1 while building llvm at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/52/builds/8779

Here is the relevant piece of the build log for the reference
Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/main.py:73: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 89962 tests, 88 workers --
Testing:  0.. 10
FAIL: Clang :: Interpreter/global-dtor.cpp (13167 of 89962)
******************** TEST 'Clang :: Interpreter/global-dtor.cpp' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
cat /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang/test/Interpreter/global-dtor.cpp | /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/clang-repl | /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang/test/Interpreter/global-dtor.cpp # RUN: at line 6
+ cat /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang/test/Interpreter/global-dtor.cpp
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/clang-repl
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang/test/Interpreter/global-dtor.cpp
JIT session error: In graph incr_module_10-jitted-objectbuffer, section .text.startup: relocation target "__dso_handle" at address 0x7576c9c23000 is out of range of Delta32 fixup at 0x7176c860d02f (<anonymous block> @ 0x7176c860d010 + 0x1f)
error: Failed to materialize symbols: { (main, { DW.ref.__gxx_personality_v0, __clang_call_terminate, d, _ZN1DD2Ev, _ZN1DC2Ev, __orc_init_func.incr_module_10, $.incr_module_10.__inits.0 }) }
error: Failed to materialize symbols: { (main, { __orc_init_func.incr_module_10 }) }
/home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang/test/Interpreter/global-dtor.cpp:11:11: error: CHECK: expected string not found in input
// CHECK: D[f=1.000000, m=0x0]
          ^
<stdin>:1:1: note: scanning from here
clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> 
^
<stdin>:1:11: note: possible intended match here
clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> 
          ^

Input file: <stdin>
Check file: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang/test/Interpreter/global-dtor.cpp

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl>  
check:11'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:11'1               ?                                                                                                                                                   possible intended match
>>>>>>

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
Step 11 (stage2/asan check) failure: stage2/asan check (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/main.py:73: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 89962 tests, 88 workers --
Testing:  0.. 10
FAIL: Clang :: Interpreter/global-dtor.cpp (13167 of 89962)
******************** TEST 'Clang :: Interpreter/global-dtor.cpp' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
cat /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang/test/Interpreter/global-dtor.cpp | /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/clang-repl | /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang/test/Interpreter/global-dtor.cpp # RUN: at line 6
+ cat /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang/test/Interpreter/global-dtor.cpp
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/clang-repl
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang/test/Interpreter/global-dtor.cpp
JIT session error: In graph incr_module_10-jitted-objectbuffer, section .text.startup: relocation target "__dso_handle" at address 0x7576c9c23000 is out of range of Delta32 fixup at 0x7176c860d02f (<anonymous block> @ 0x7176c860d010 + 0x1f)
error: Failed to materialize symbols: { (main, { DW.ref.__gxx_personality_v0, __clang_call_terminate, d, _ZN1DD2Ev, _ZN1DC2Ev, __orc_init_func.incr_module_10, $.incr_module_10.__inits.0 }) }
error: Failed to materialize symbols: { (main, { __orc_init_func.incr_module_10 }) }
/home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang/test/Interpreter/global-dtor.cpp:11:11: error: CHECK: expected string not found in input
// CHECK: D[f=1.000000, m=0x0]
          ^
<stdin>:1:1: note: scanning from here
clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> 
^
<stdin>:1:11: note: possible intended match here
clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> 
          ^

Input file: <stdin>
Check file: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/clang/test/Interpreter/global-dtor.cpp

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl> clang-repl>  
check:11'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:11'1               ?                                                                                                                                                   possible intended match
>>>>>>

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants