[clang] [llvm] [libc] [mlir] [openmp] [llvm][unittests] add NDEBUG for some unittests (PR #80821)

via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 6 03:17:57 PST 2024


https://github.com/huaatian updated https://github.com/llvm/llvm-project/pull/80821

>From 04fbb56ca8e3f4e0ffeec0ac869c0f717bee81f0 Mon Sep 17 00:00:00 2001
From: huaatian <huaatian at sina.com>
Date: Tue, 6 Feb 2024 17:04:38 +0800
Subject: [PATCH 1/2] [llvm][unittests] add NDEBUG for some unittests

---
 llvm/unittests/IR/BasicBlockTest.cpp | 2 ++
 llvm/unittests/IR/FunctionTest.cpp   | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/llvm/unittests/IR/BasicBlockTest.cpp b/llvm/unittests/IR/BasicBlockTest.cpp
index 3756f227143a50..79bf72bf32f914 100644
--- a/llvm/unittests/IR/BasicBlockTest.cpp
+++ b/llvm/unittests/IR/BasicBlockTest.cpp
@@ -472,6 +472,7 @@ TEST(BasicBlockTest, SpliceInstrRange) {
 }
 
 #ifdef EXPENSIVE_CHECKS
+#ifndef NDEBUG
 TEST(BasicBlockTest, SpliceEndBeforeBegin) {
   LLVMContext Ctx;
   std::unique_ptr<Module> M = parseIR(Ctx, R"(
@@ -503,6 +504,7 @@ TEST(BasicBlockTest, SpliceEndBeforeBegin) {
                             FromI1->getIterator()),
                "FromBeginIt not before FromEndIt!");
 }
+#endif //NDEBUG
 #endif //EXPENSIVE_CHECKS
 
 TEST(BasicBlockTest, EraseRange) {
diff --git a/llvm/unittests/IR/FunctionTest.cpp b/llvm/unittests/IR/FunctionTest.cpp
index 8e77dfbb9dbd99..cb364cf3028871 100644
--- a/llvm/unittests/IR/FunctionTest.cpp
+++ b/llvm/unittests/IR/FunctionTest.cpp
@@ -410,6 +410,7 @@ TEST(FunctionTest, SpliceBBRange) {
 }
 
 #ifdef EXPENSIVE_CHECKS
+#ifndef NDEBUG
 TEST(FunctionTest, SpliceEndBeforeBegin) {
   LLVMContext Ctx;
   std::unique_ptr<Module> M = parseIR(Ctx, R"(
@@ -442,6 +443,7 @@ TEST(FunctionTest, SpliceEndBeforeBegin) {
                            FromBB1->getIterator()),
                "FromBeginIt not before FromEndIt!");
 }
+#endif //NDEBUG
 #endif //EXPENSIVE_CHECKS
 
 TEST(FunctionTest, EraseBBs) {

>From f1049d96b3d04bfd96d810ec991baac939a3e51b Mon Sep 17 00:00:00 2001
From: huaatian <huaatian at sina.com>
Date: Tue, 6 Feb 2024 18:40:39 +0800
Subject: [PATCH 2/2] [llvm][unittests] add NDEBUG for some unittests update 1

---
 llvm/unittests/IR/BasicBlockTest.cpp | 2 +-
 llvm/unittests/IR/FunctionTest.cpp   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/unittests/IR/BasicBlockTest.cpp b/llvm/unittests/IR/BasicBlockTest.cpp
index 79bf72bf32f914..26c29b15b44e09 100644
--- a/llvm/unittests/IR/BasicBlockTest.cpp
+++ b/llvm/unittests/IR/BasicBlockTest.cpp
@@ -504,7 +504,7 @@ TEST(BasicBlockTest, SpliceEndBeforeBegin) {
                             FromI1->getIterator()),
                "FromBeginIt not before FromEndIt!");
 }
-#endif //NDEBUG
+#endif // NDEBUG
 #endif //EXPENSIVE_CHECKS
 
 TEST(BasicBlockTest, EraseRange) {
diff --git a/llvm/unittests/IR/FunctionTest.cpp b/llvm/unittests/IR/FunctionTest.cpp
index cb364cf3028871..d95fe3be50dd48 100644
--- a/llvm/unittests/IR/FunctionTest.cpp
+++ b/llvm/unittests/IR/FunctionTest.cpp
@@ -443,7 +443,7 @@ TEST(FunctionTest, SpliceEndBeforeBegin) {
                            FromBB1->getIterator()),
                "FromBeginIt not before FromEndIt!");
 }
-#endif //NDEBUG
+#endif // NDEBUG
 #endif //EXPENSIVE_CHECKS
 
 TEST(FunctionTest, EraseBBs) {



More information about the cfe-commits mailing list