[llvm] [BOLT] Fix assertion test (PR #169635)

Gergely Bálint via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 26 03:02:11 PST 2025


https://github.com/bgergely0 created https://github.com/llvm/llvm-project/pull/169635

Add `#ifndef NDEBUG` to exclude the failing assertion test from
no assertion build.

>From 5b736e1c08c95fbcf9bdcf6871e63e10676fbaaf Mon Sep 17 00:00:00 2001
From: Gergely Balint <gergely.balint at arm.com>
Date: Wed, 26 Nov 2025 10:39:19 +0000
Subject: [PATCH] [BOLT] Fix assertion test

Add `#ifndef NDEBUG` to exclude the failing assertion test from
no assertion build.
---
 bolt/unittests/Core/MCPlusBuilder.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/bolt/unittests/Core/MCPlusBuilder.cpp b/bolt/unittests/Core/MCPlusBuilder.cpp
index 439d72a343ce8..7f2a2100363e9 100644
--- a/bolt/unittests/Core/MCPlusBuilder.cpp
+++ b/bolt/unittests/Core/MCPlusBuilder.cpp
@@ -171,9 +171,11 @@ TEST_P(MCPlusBuilderTester, AArch64_BTI) {
   ASSERT_EQ(II->getOperand(0).getImm(), 34);
   ASSERT_TRUE(BC->MIB->isBTILandingPad(*II, true, false));
 
+#ifndef NDEBUG
   MCInst BTIinvalid;
   ASSERT_DEATH(BC->MIB->createBTI(BTIinvalid, false, false),
                "No target kinds!");
+#endif
 
   MCInst Paciasp = MCInstBuilder(AArch64::PACIASP);
   II = BB->addInstruction(Paciasp);



More information about the llvm-commits mailing list