Skip to content

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Jul 28, 2025

This is a step towards separating the set of available libcalls
from the lowering decision of which call to use. Libcall recognition
now directly checks availability instead of indirectly checking through
the lowering table.

@llvmbot
Copy link
Member

llvmbot commented Jul 28, 2025

@llvm/pr-subscribers-llvm-adt
@llvm/pr-subscribers-tablegen
@llvm/pr-subscribers-backend-x86

@llvm/pr-subscribers-llvm-ir

Author: Matt Arsenault (arsenm)

Changes

This is a step towards separating the set of available libcalls
from the lowering decision of which call to use. Libcall recognition
now directly checks availability instead of indirectly checking through
the lowering table.


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

6 Files Affected:

  • (modified) llvm/include/llvm/IR/RuntimeLibcalls.h (+60)
  • (modified) llvm/lib/IR/RuntimeLibcalls.cpp (+2-6)
  • (modified) llvm/test/TableGen/RuntimeLibcallEmitter-calling-conv.td (+15)
  • (modified) llvm/test/TableGen/RuntimeLibcallEmitter-conflict-warning.td (+15)
  • (modified) llvm/test/TableGen/RuntimeLibcallEmitter.td (+20)
  • (modified) llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp (+24)
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index ad3bb4eca1c56..0de7d14bd0f60 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -53,8 +53,64 @@ static inline auto libcall_impls() {
   return enum_seq(static_cast<RTLIB::LibcallImpl>(1), RTLIB::NumLibcallImpls);
 }
 
+/// Manage a bitset representing the list of available libcalls for a module.
+///
+/// Most of this exists because std::bitset cannot be statically constructed in
+/// a size large enough before c++23
+class LibcallImplBitset {
+private:
+  using BitWord = uint64_t;
+  static constexpr unsigned BitWordSize = sizeof(BitWord) * CHAR_BIT;
+  static constexpr size_t NumArrayElts =
+      divideCeil(RTLIB::NumLibcallImpls, BitWordSize);
+  using Storage = BitWord[NumArrayElts];
+
+  Storage Bits = {};
+
+  /// Get bitmask for \p Impl in its Bits element.
+  static constexpr BitWord getBitmask(RTLIB::LibcallImpl Impl) {
+    unsigned Idx = static_cast<unsigned>(Impl);
+    return BitWord(1) << (Idx % BitWordSize);
+  }
+
+  /// Get index of array element of Bits for \p Impl
+  static constexpr unsigned getArrayIdx(RTLIB::LibcallImpl Impl) {
+    return static_cast<unsigned>(Impl) / BitWordSize;
+  }
+
+public:
+  constexpr LibcallImplBitset() = default;
+  constexpr LibcallImplBitset(const Storage &Src) {
+    for (size_t I = 0; I != NumArrayElts; ++I)
+      Bits[I] = Src[I];
+  }
+
+  /// Check if a LibcallImpl is available.
+  constexpr bool test(RTLIB::LibcallImpl Impl) const {
+    BitWord Mask = getBitmask(Impl);
+    return (Bits[getArrayIdx(Impl)] & Mask) != 0;
+  }
+
+  /// Mark a LibcallImpl as available
+  void set(RTLIB::LibcallImpl Impl) {
+    assert(Impl != RTLIB::Unsupported && "cannot enable unsupported libcall");
+    Bits[getArrayIdx(Impl)] |= getBitmask(Impl);
+  }
+
+  /// Mark a LibcallImpl as unavailable
+  void unset(RTLIB::LibcallImpl Impl) {
+    assert(Impl != RTLIB::Unsupported && "cannot enable unsupported libcall");
+    Bits[getArrayIdx(Impl)] &= ~getBitmask(Impl);
+  }
+};
+
 /// A simple container for information about the supported runtime calls.
 struct RuntimeLibcallsInfo {
+private:
+  /// Bitset of libcalls a module may emit a call to.
+  LibcallImplBitset AvailableLibcallImpls;
+
+public:
   explicit RuntimeLibcallsInfo(
       const Triple &TT,
       ExceptionHandling ExceptionModel = ExceptionHandling::None,
@@ -132,6 +188,10 @@ struct RuntimeLibcallsInfo {
     return ImplToLibcall[Impl];
   }
 
+  bool isAvailable(RTLIB::LibcallImpl Impl) const {
+    return AvailableLibcallImpls.test(Impl);
+  }
+
   /// Check if this is valid libcall for the current module, otherwise
   /// RTLIB::Unsupported.
   RTLIB::LibcallImpl getSupportedLibcallImpl(StringRef FuncName) const;
diff --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp
index 8c90c52141dc7..569f63f28db77 100644
--- a/llvm/lib/IR/RuntimeLibcalls.cpp
+++ b/llvm/lib/IR/RuntimeLibcalls.cpp
@@ -114,12 +114,8 @@ RuntimeLibcallsInfo::getSupportedLibcallImpl(StringRef FuncName) const {
   for (auto I = Range.begin(); I != Range.end(); ++I) {
     RTLIB::LibcallImpl Impl =
         static_cast<RTLIB::LibcallImpl>(I - RuntimeLibcallNameOffsets.begin());
-
-    // FIXME: This should not depend on looking up ImplToLibcall, only the list
-    // of libcalls for the module.
-    RTLIB::LibcallImpl Recognized = LibcallImpls[ImplToLibcall[Impl]];
-    if (Recognized != RTLIB::Unsupported)
-      return Recognized;
+    if (isAvailable(Impl))
+      return Impl;
   }
 
   return RTLIB::Unsupported;
diff --git a/llvm/test/TableGen/RuntimeLibcallEmitter-calling-conv.td b/llvm/test/TableGen/RuntimeLibcallEmitter-calling-conv.td
index 49d5ecaa0e5c5..c2aeae285a427 100644
--- a/llvm/test/TableGen/RuntimeLibcallEmitter-calling-conv.td
+++ b/llvm/test/TableGen/RuntimeLibcallEmitter-calling-conv.td
@@ -48,6 +48,11 @@ def MSP430LibraryWithCondCC : SystemRuntimeLibrary<isMSP430,
 // CHECK-NEXT:     Entry = DefaultCC;
 // CHECK-NEXT:   }
 // CHECK-EMPTY:
+// CHECK-NEXT:   static constexpr LibcallImplBitset SystemAvailableImpls({
+// CHECK-NEXT:     0x0000000000001a
+// CHECK-NEXT:   });
+// CHECK-NEXT:   AvailableLibcallImpls = SystemAvailableImpls;
+// CHECK-EMPTY:
 // CHECK-NEXT:    static const LibcallImplPair LibraryCalls[] = {
 // CHECK-NEXT:        {RTLIB::MALLOC, RTLIB::malloc}, // malloc
 // CHECK-NEXT:    };
@@ -70,6 +75,11 @@ def MSP430LibraryWithCondCC : SystemRuntimeLibrary<isMSP430,
 // CHECK-NEXT:  }
 // CHECK-EMPTY:
 // CHECK-NEXT: if (TT.getArch() == Triple::avr) {
+// CHECK-NEXT:   static constexpr LibcallImplBitset SystemAvailableImpls({
+// CHECK-NEXT:     0x0000000000001a
+// CHECK-NEXT:   });
+// CHECK-NEXT:   AvailableLibcallImpls = SystemAvailableImpls;
+// CHECK-EMPTY:
 // CHECK-NEXT:   static const LibcallImplPair LibraryCalls[] = {
 // CHECK-NEXT:       {RTLIB::MALLOC, RTLIB::malloc}, // malloc
 // CHECK-NEXT:   };
@@ -92,6 +102,11 @@ def MSP430LibraryWithCondCC : SystemRuntimeLibrary<isMSP430,
 // CHECK-NEXT:  }
 // CHECK-EMPTY:
 // CHECK-NEXT:  if (TT.getArch() == Triple::msp430) {
+// CHECK-NEXT:    static constexpr LibcallImplBitset SystemAvailableImpls({
+// CHECK-NEXT:      0x0000000000001a
+// CHECK-NEXT:    });
+// CHECK-NEXT:    AvailableLibcallImpls = SystemAvailableImpls;
+// CHECK-EMPTY:
 // CHECK-NEXT:    static const LibcallImplPair LibraryCalls[] = {
 // CHECK-NEXT:        {RTLIB::MALLOC, RTLIB::malloc}, // malloc
 // CHECK-NEXT:    };
diff --git a/llvm/test/TableGen/RuntimeLibcallEmitter-conflict-warning.td b/llvm/test/TableGen/RuntimeLibcallEmitter-conflict-warning.td
index 00c9d53846326..2a8739335a8dd 100644
--- a/llvm/test/TableGen/RuntimeLibcallEmitter-conflict-warning.td
+++ b/llvm/test/TableGen/RuntimeLibcallEmitter-conflict-warning.td
@@ -25,6 +25,11 @@ def dup1 : RuntimeLibcallImpl<ANOTHER_DUP>;
 // func_a and func_b both provide SOME_FUNC.
 
 // CHECK: if (isTargetArchA()) {
+// CHECK-NEXT: static constexpr LibcallImplBitset SystemAvailableImpls({
+// CHECK-NEXT:   0x00000000000018
+// CHECK-NEXT: });
+// CHECK-NEXT: AvailableLibcallImpls = SystemAvailableImpls;
+// CHECK-EMPTY:
 // CHECK-NEXT: static const LibcallImplPair LibraryCalls[] = {
 // CHECK-NEXT:   {RTLIB::SOME_FUNC, RTLIB::func_b}, // func_b
 // CHECK-NEXT: };
@@ -35,6 +40,11 @@ def TheSystemLibraryA : SystemRuntimeLibrary<isTargetArchA,
 >;
 
 // CHECK: if (isTargetArchB()) {
+// CHECK-NEXT: static constexpr LibcallImplBitset SystemAvailableImpls({
+// CHECK-NEXT:   0x00000000000058
+// CHECK-NEXT: });
+// CHECK-NEXT: AvailableLibcallImpls = SystemAvailableImpls;
+// CHECK-EMPTY:
 // CHECK-NEXT: static const LibcallImplPair LibraryCalls[] = {
 // CHECK-NEXT:   {RTLIB::OTHER_FUNC, RTLIB::other_func}, // other_func
 // CHECK-NEXT:  {RTLIB::SOME_FUNC, RTLIB::func_a}, // func_a
@@ -46,6 +56,11 @@ def TheSystemLibraryB : SystemRuntimeLibrary<isTargetArchB,
 >;
 
 // CHECK: if (isTargetArchC()) {
+// CHECK-NEXT: static constexpr LibcallImplBitset SystemAvailableImpls({
+// CHECK-NEXT:   0x0000000000007e
+// CHECK-NEXT: });
+// CHECK-NEXT: AvailableLibcallImpls = SystemAvailableImpls;
+// CHECK-EMPTY:
 // CHECK-NEXT: static const LibcallImplPair LibraryCalls[] = {
 // CHECK-NEXT:   {RTLIB::ANOTHER_DUP, RTLIB::dup1}, // dup1
 // CHECK-NEXT:   {RTLIB::OTHER_FUNC, RTLIB::other_func}, // other_func
diff --git a/llvm/test/TableGen/RuntimeLibcallEmitter.td b/llvm/test/TableGen/RuntimeLibcallEmitter.td
index 642f8b85a89c6..fe4159201574b 100644
--- a/llvm/test/TableGen/RuntimeLibcallEmitter.td
+++ b/llvm/test/TableGen/RuntimeLibcallEmitter.td
@@ -157,6 +157,11 @@ def BlahLibrary : SystemRuntimeLibrary<isBlahArch, (add calloc, LibraryWithCondi
 // CHECK-NEXT:  };
 // CHECK-EMPTY:
 // CHECK-NEXT: if (TT.getArch() == Triple::blah) {
+// CHECK-NEXT:     static constexpr LibcallImplBitset SystemAvailableImpls({
+// CHECK-NEXT:       0x000000000000fc
+// CHECK-NEXT:     });
+// CHECK-NEXT:     AvailableLibcallImpls = SystemAvailableImpls;
+// CHECK-EMPTY:
 // CHECK-NEXT:     static const LibcallImplPair LibraryCalls[] = {
 // CHECK-NEXT:         {RTLIB::BZERO, RTLIB::bzero}, // bzero
 // CHECK-NEXT:         {RTLIB::CALLOC, RTLIB::calloc}, // calloc
@@ -194,6 +199,11 @@ def BlahLibrary : SystemRuntimeLibrary<isBlahArch, (add calloc, LibraryWithCondi
 // CHECK-NEXT: }
 // CHECK-EMPTY:
 // CHECK-NEXT: if (TT.getArch() == Triple::buzz) {
+// CHECK-NEXT:    static constexpr LibcallImplBitset SystemAvailableImpls({
+// CHECK-NEXT:      0x00000000000118
+// CHECK-NEXT:    });
+// CHECK-NEXT:    AvailableLibcallImpls = SystemAvailableImpls;
+// CHECK-EMPTY:
 // CHECK-NEXT:    static const LibcallImplPair LibraryCalls[] = {
 // CHECK-NEXT:        {RTLIB::SHL_I32, RTLIB::__ashlsi3}, // __ashlsi3
 // CHECK-NEXT:        {RTLIB::SQRT_F80, RTLIB::sqrtl_f80}, // sqrtl
@@ -208,6 +218,11 @@ def BlahLibrary : SystemRuntimeLibrary<isBlahArch, (add calloc, LibraryWithCondi
 // CHECK-NEXT: }
 // CHECK-EMPTY:
 // CHECK-NEXT: if (TT.getArch() == Triple::foo) {
+// CHECK-NEXT:    static constexpr LibcallImplBitset SystemAvailableImpls({
+// CHECK-NEXT:      0x000000000000a4
+// CHECK-NEXT:    });
+// CHECK-NEXT:    AvailableLibcallImpls = SystemAvailableImpls;
+// CHECK-EMPTY:
 // CHECK-NEXT:    static const LibcallImplPair LibraryCalls[] = {
 // CHECK-NEXT:        {RTLIB::BZERO, RTLIB::bzero}, // bzero
 // CHECK-NEXT:        {RTLIB::SQRT_F128, RTLIB::sqrtl_f128}, // sqrtl
@@ -232,6 +247,11 @@ def BlahLibrary : SystemRuntimeLibrary<isBlahArch, (add calloc, LibraryWithCondi
 // CHECK-NEXT:  }
 // CHECK-EMPTY:
 // CHECK-NEXT: if (TT.getArch() == Triple::simple) {
+// CHECK-NEXT:    static constexpr LibcallImplBitset SystemAvailableImpls({
+// CHECK-NEXT:      0x00000000000158
+// CHECK-NEXT:    });
+// CHECK-NEXT:    AvailableLibcallImpls = SystemAvailableImpls;
+// CHECK-EMPTY:
 // CHECK-NEXT:    static const LibcallImplPair LibraryCalls[] = {
 // CHECK-NEXT:        {RTLIB::CALLOC, RTLIB::calloc}, // calloc
 // CHECK-NEXT:        {RTLIB::SHL_I32, RTLIB::__ashlsi3}, // __ashlsi3
diff --git a/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp b/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp
index 412431b96d030..853209f94ea2c 100644
--- a/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp
+++ b/llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp
@@ -8,6 +8,7 @@
 
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/Format.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/TableGen/Error.h"
@@ -402,6 +403,10 @@ void RuntimeLibcallEmitter::emitSystemRuntimeLibrarySetCalls(
         PredicateWithCC()); // No predicate or CC override first.
 
     DenseMap<PredicateWithCC, LibcallsWithCC> Pred2Funcs;
+
+    SmallVector<uint64_t, 32> BitsetValues(
+        divideCeil(RuntimeLibcallImplDefList.size(), 64));
+
     for (const Record *Elt : *Elements) {
       const RuntimeLibcallImpl *LibCallImpl = getRuntimeLibcallImpl(Elt);
       if (!LibCallImpl) {
@@ -410,6 +415,9 @@ void RuntimeLibcallEmitter::emitSystemRuntimeLibrarySetCalls(
         continue;
       }
 
+      size_t Idx = LibCallImpl->getEnumVal();
+      BitsetValues[Idx / 64] |= uint64_t(1) << (Idx % 64);
+
       auto It = Func2Preds.find(LibCallImpl);
       if (It == Func2Preds.end()) {
         Pred2Funcs[PredicateWithCC()].LibcallImpls.push_back(LibCallImpl);
@@ -427,6 +435,22 @@ void RuntimeLibcallEmitter::emitSystemRuntimeLibrarySetCalls(
       }
     }
 
+    OS << "    static constexpr LibcallImplBitset SystemAvailableImpls({\n"
+       << indent(6);
+
+    ListSeparator LS;
+    unsigned EntryCount = 0;
+    for (uint64_t Bits : BitsetValues) {
+      if (EntryCount++ == 4) {
+        EntryCount = 1;
+        OS << ",\n" << indent(6);
+      } else
+        OS << LS;
+      OS << format_hex(Bits, 16);
+    }
+    OS << "\n    });\n"
+          "    AvailableLibcallImpls = SystemAvailableImpls;\n\n";
+
     SmallVector<PredicateWithCC, 0> SortedPredicates =
         PredicateSorter.takeVector();
 

@arsenm arsenm force-pushed the users/arsenm/tablegen/emit-runtime-libcalls-available-bitset branch from 61b2148 to 78b0865 Compare July 28, 2025 03:26
@arsenm arsenm force-pushed the users/arsenm/runtime-libcalls/use-tablegen-default-handling branch from 5843fba to a8d3505 Compare August 3, 2025 00:41
@arsenm arsenm force-pushed the users/arsenm/tablegen/emit-runtime-libcalls-available-bitset branch 2 times, most recently from 1481306 to c992d2b Compare August 3, 2025 16:32
@arsenm arsenm force-pushed the users/arsenm/runtime-libcalls/use-tablegen-default-handling branch from a8d3505 to 744161e Compare August 3, 2025 16:32
Base automatically changed from users/arsenm/runtime-libcalls/use-tablegen-default-handling to main August 3, 2025 23:32
@arsenm arsenm force-pushed the users/arsenm/tablegen/emit-runtime-libcalls-available-bitset branch from c992d2b to d3ad2c4 Compare August 4, 2025 06:18
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this what llvm/include/llvm/ADT/Bitset.h is for?

@arsenm arsenm force-pushed the users/arsenm/tablegen/emit-runtime-libcalls-available-bitset branch from d3ad2c4 to 7b13ce5 Compare August 4, 2025 13:07
@arsenm arsenm force-pushed the users/arsenm/tablegen/emit-runtime-libcalls-available-bitset branch from b2cb9ad to 226968e Compare August 6, 2025 02:06
@arsenm arsenm force-pushed the users/arsenm/tablegen/emit-runtime-libcalls-available-bitset branch 3 times, most recently from f48e119 to a4c65ba Compare August 17, 2025 01:25
@arsenm arsenm force-pushed the users/arsenm/tablegen/emit-runtime-libcalls-available-bitset branch from a4c65ba to b7c546f Compare September 18, 2025 01:27
endif ()

foreach(i IN ITEMS 8 4)
try_compile(SIZEOF_UINTPTR_T_IS_${i}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try_compile compiles for target arch, not native arch, AFAIK

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which is correct? The point is to match what the compiler is being compiled for

Copy link
Contributor

@s-barannikov s-barannikov Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TL;DR I don't know.

When I wrote this comment I assumed LLVM_NATIVE_ARCH is the architecutre the compiler will run on. It doesn't seem to be the case: it gets its value from LLVM_TARGET_ARCH (unless it equals to "host"), which has the following comment:

LLVM_TARGET_ARCH Set target to use for LLVM JIT or use \"host\" for automatic detection.

I guess it is not what we need here.

If LLVM_TARGET_ARCH == "host", LLVM_NATIVE_ARCH is set to the value of LLVM_HOST_TRIPLE and the above if/else adjusts it as necessary.
https://llvm.org/docs/HowToCrossCompileLLVM.html says

LLVM_HOST_TRIPLE: Specifies the target triple of the system the built LLVM will run on

This does look relevant, but I don't know how to pass it to try_compile or whether it is passed automatically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try_compile should be the correct check for the current compile target. The hazard would be for the tablegen bootstrap, but since this is in the base config I think it should work

Copy link
Contributor

@s-barannikov s-barannikov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the end, it might be easier to change SmallBitVector to use uint64_t.

@arsenm
Copy link
Contributor Author

arsenm commented Sep 19, 2025

In the end, it might be easier to change SmallBitVector to use uint64_t.

Or size_t, it's close enough to uintptr_t

@arsenm arsenm force-pushed the users/arsenm/tablegen/emit-runtime-libcalls-available-bitset branch 2 times, most recently from 796f028 to f38dc22 Compare October 10, 2025 03:17
This is a step towards separating the set of available libcalls
from the lowering decision of which call to use. Libcall recognition
now directly checks availability instead of indirectly checking through
the lowering table.
@arsenm arsenm force-pushed the users/arsenm/tablegen/emit-runtime-libcalls-available-bitset branch from f38dc22 to 17f78f0 Compare October 10, 2025 03:18
Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@arsenm arsenm enabled auto-merge (squash) October 10, 2025 07:58
@arsenm arsenm merged commit aa406aa into main Oct 10, 2025
9 of 10 checks passed
@arsenm arsenm deleted the users/arsenm/tablegen/emit-runtime-libcalls-available-bitset branch October 10, 2025 08:27
@DavidSpickett
Copy link
Collaborator

This is failing to build on 32-bit:

/usr/lib/gcc/arm-linux-gnueabihf/14/../../../../include/c++/14/array:208:2: note: non-constexpr function '__glibcxx_assert_fail' cannot be used in a constant expression
  208 |         __glibcxx_requires_subscript(__n);
      |         ^
/usr/lib/gcc/arm-linux-gnueabihf/14/../../../../include/c++/14/debug/assertions.h:44:3: note: expanded from macro '__glibcxx_requires_subscript'
   44 |   __glibcxx_assert(_N < this->size())
      |   ^
/usr/lib/gcc/arm-linux-gnueabihf/14/../../../../include/arm-linux-gnueabihf/c++/14/bits/c++config.h:597:7: note: expanded from macro '__glibcxx_assert'
  597 |       _GLIBCXX_ASSERT_FAIL(cond);                                       \
      |       ^
/usr/lib/gcc/arm-linux-gnueabihf/14/../../../../include/arm-linux-gnueabihf/c++/14/bits/c++config.h:586:3: note: expanded from macro '_GLIBCXX_ASSERT_FAIL'
  586 |   std::__glibcxx_assert_fail(__FILE__, __LINE__, __PRETTY_FUNCTION__,   \
      |   ^
/home/david.spickett/llvm-project/llvm/include/llvm/ADT/Bitset.h:53:9: note: in call to 'this->Bits.operator[](55)'
   53 |         Bits[2 * I + 1] = static_cast<uint32_t>(Elt >> 32);
      |         ^~~~~~~~~~~~~~~
/home/david.spickett/llvm-project/llvm/include/llvm/IR/RuntimeLibcalls.h:64:9: note: in call to 'Bitset({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 210, 18446744073707454464ULL, 13468196062572838911ULL, 8068962058563468478LL, 5908723102954010539LL, 15528411416389222482ULL, 279223176897142645LL, 3746994889972252672LL, 18440270288368131053ULL, 8953156059212546047LL, 15913167699476203134ULL, 7906048719147421110LL, 7903888500135409335LL, 15083311574455LL, 7905743145847713152LL, 14043})'
   64 |       : Bitset(Src) {}
      |         ^~~~~~~~~~~
/home/david.spickett/build-llvm-arm/include/llvm/IR/RuntimeLibcalls.inc:30015:40: note: in call to 'LibcallImplBitset({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 210, 18446744073707454464ULL, 13468196062572838911ULL, 8068962058563468478LL, 5908723102954010539LL, 15528411416389222482ULL, 279223176897142645LL, 3746994889972252672LL, 18440270288368131053ULL, 8953156059212546047LL, 15913167699476203134ULL, 7906048719147421110LL, 7903888500135409335LL, 15083311574455LL, 7905743145847713152LL, 14043})'
 30015 |     static constexpr LibcallImplBitset SystemAvailableImpls({
       |                                        ^~~~~~~~~~~~~~~~~~~~~~
 30016 |       0x00000000000000, 0x00000000000000, 0x00000000000000, 0x00000000000000,
       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 30017 |       0x00000000000000, 0x00000000000000, 0x00000000000000, 0x00000000000000,
       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 30018 |       0x00000000000000, 0x00000000000000, 0x00000000000000, 0x00000000000000,
       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 30019 |       0x000000000000d2, 0xffffffffffe00000, 0xbae8a4f61af7ffff, 0x6ffab63db6c7bcbe,
       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 30020 |       0x5200005b3bb7b7ab, 0xd77fffe900000052, 0x3e0000000029f75, 0x3400000000000000,
       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 30021 |       0xffe90020645f5bed, 0x7c3fffffffffffff, 0xdcd6edb60a7fc67e, 0x6db7ed6c09b6cdb6,
       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 30022 |       0x6db040b6daddb6b7, 0x000db7db6dadb7, 0x6db6d78135bb6d80, 0x000000000036db
       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 30023 |     });
       |     ~~
/usr/lib/gcc/arm-linux-gnueabihf/14/../../../../include/arm-linux-gnueabihf/c++/14/bits/c++config.h:579:3: note: declared here
  579 |   __glibcxx_assert_fail /* Called when a precondition violation is detected. */
      |   ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

I'll merge my other fix to BitSet and figure out how to fix it from there.

@DavidSpickett
Copy link
Collaborator

Somehow #162814 fixed it.

If it fails like this for anyone else, you could try using .data()[] instead.

DharuniRAcharya pushed a commit to DharuniRAcharya/llvm-project that referenced this pull request Oct 13, 2025
This is a step towards separating the set of available libcalls
from the lowering decision of which call to use. Libcall recognition
now directly checks availability instead of indirectly checking through
the lowering table.
akadutta pushed a commit to akadutta/llvm-project that referenced this pull request Oct 14, 2025
This is a step towards separating the set of available libcalls
from the lowering decision of which call to use. Libcall recognition
now directly checks availability instead of indirectly checking through
the lowering table.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend:X86 cmake Build system in general and CMake in particular llvm:adt llvm:ir tablegen

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants