Author: Jan Patrick Lehr Date: 2024-12-18T10:58:55+01:00 New Revision: 00f4bf5a582298ec942d86bf69571dfe66354598
URL: https://github.com/llvm/llvm-project/commit/00f4bf5a582298ec942d86bf69571dfe66354598 DIFF: https://github.com/llvm/llvm-project/commit/00f4bf5a582298ec942d86bf69571dfe66354598.diff LOG: Revert "LLVMContext: Cleanup registration of known bundle IDs (#120359)" This reverts commit 3666de9c8e3bfd3a3b604e0e434341ec49cb3a6d. Added: Modified: llvm/lib/IR/LLVMContext.cpp Removed: ################################################################################ diff --git a/llvm/lib/IR/LLVMContext.cpp b/llvm/lib/IR/LLVMContext.cpp index 9acc15f11316a2..eb51a751bfa088 100644 --- a/llvm/lib/IR/LLVMContext.cpp +++ b/llvm/lib/IR/LLVMContext.cpp @@ -31,35 +31,6 @@ using namespace llvm; -static constexpr StringRef knownBundleName(unsigned BundleTagID) { - switch (BundleTagID) { - case LLVMContext::OB_deopt: - return "deopt"; - case LLVMContext::OB_funclet: - return "funclet"; - case LLVMContext::OB_gc_transition: - return "gc-transition"; - case LLVMContext::OB_cfguardtarget: - return "cfguardtarget"; - case LLVMContext::OB_preallocated: - return "preallocated"; - case LLVMContext::OB_gc_live: - return "gc-live"; - case LLVMContext::OB_clang_arc_attachedcall: - return "clang.arc.attachedcall"; - case LLVMContext::OB_ptrauth: - return "ptrauth"; - case LLVMContext::OB_kcfi: - return "kcfi"; - case LLVMContext::OB_convergencectrl: - return "convergencectrl"; - default: - llvm_unreachable("unknown bundle id"); - } - - llvm_unreachable("covered switch"); -} - LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl(*this)) { // Create the fixed metadata kinds. This is done in the same order as the // MD_* enum values so that they correspond. @@ -75,12 +46,56 @@ LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl(*this)) { (void)ID; } - for (unsigned BundleTagID = LLVMContext::OB_deopt; - BundleTagID <= LLVMContext::OB_convergencectrl; ++BundleTagID) { - [[maybe_unused]] const auto *Entry = - pImpl->getOrInsertBundleTag(knownBundleName(BundleTagID)); - assert(Entry->second == BundleTagID && "operand bundle id drifted!"); - } + auto *DeoptEntry = pImpl->getOrInsertBundleTag("deopt"); + assert(DeoptEntry->second == LLVMContext::OB_deopt && + "deopt operand bundle id drifted!"); + (void)DeoptEntry; + + auto *FuncletEntry = pImpl->getOrInsertBundleTag("funclet"); + assert(FuncletEntry->second == LLVMContext::OB_funclet && + "funclet operand bundle id drifted!"); + (void)FuncletEntry; + + auto *GCTransitionEntry = pImpl->getOrInsertBundleTag("gc-transition"); + assert(GCTransitionEntry->second == LLVMContext::OB_gc_transition && + "gc-transition operand bundle id drifted!"); + (void)GCTransitionEntry; + + auto *CFGuardTargetEntry = pImpl->getOrInsertBundleTag("cfguardtarget"); + assert(CFGuardTargetEntry->second == LLVMContext::OB_cfguardtarget && + "cfguardtarget operand bundle id drifted!"); + (void)CFGuardTargetEntry; + + auto *PreallocatedEntry = pImpl->getOrInsertBundleTag("preallocated"); + assert(PreallocatedEntry->second == LLVMContext::OB_preallocated && + "preallocated operand bundle id drifted!"); + (void)PreallocatedEntry; + + auto *GCLiveEntry = pImpl->getOrInsertBundleTag("gc-live"); + assert(GCLiveEntry->second == LLVMContext::OB_gc_live && + "gc-transition operand bundle id drifted!"); + (void)GCLiveEntry; + + auto *ClangAttachedCall = + pImpl->getOrInsertBundleTag("clang.arc.attachedcall"); + assert(ClangAttachedCall->second == LLVMContext::OB_clang_arc_attachedcall && + "clang.arc.attachedcall operand bundle id drifted!"); + (void)ClangAttachedCall; + + auto *PtrauthEntry = pImpl->getOrInsertBundleTag("ptrauth"); + assert(PtrauthEntry->second == LLVMContext::OB_ptrauth && + "ptrauth operand bundle id drifted!"); + (void)PtrauthEntry; + + auto *KCFIEntry = pImpl->getOrInsertBundleTag("kcfi"); + assert(KCFIEntry->second == LLVMContext::OB_kcfi && + "kcfi operand bundle id drifted!"); + (void)KCFIEntry; + + auto *ConvergenceCtrlEntry = pImpl->getOrInsertBundleTag("convergencectrl"); + assert(ConvergenceCtrlEntry->second == LLVMContext::OB_convergencectrl && + "convergencectrl operand bundle id drifted!"); + (void)ConvergenceCtrlEntry; SyncScope::ID SingleThreadSSID = pImpl->getOrInsertSyncScopeID("singlethread"); _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits