[llvm] bf52884 - [DomTreeUpdater] Fix use after free in unittests (#97133)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 28 18:33:42 PDT 2024
Author: paperchalice
Date: 2024-06-29T09:33:39+08:00
New Revision: bf528849819733482cff205f3bdf1fe9ce2b92a4
URL: https://github.com/llvm/llvm-project/commit/bf528849819733482cff205f3bdf1fe9ce2b92a4
DIFF: https://github.com/llvm/llvm-project/commit/bf528849819733482cff205f3bdf1fe9ce2b92a4.diff
LOG: [DomTreeUpdater] Fix use after free in unittests (#97133)
In #96851, the unit test contains use after free, which triggers
sanitizer error.
Fix https://lab.llvm.org/buildbot/#/builders/169/builds/490
Added:
Modified:
llvm/unittests/CodeGen/MachineDomTreeUpdaterTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/CodeGen/MachineDomTreeUpdaterTest.cpp b/llvm/unittests/CodeGen/MachineDomTreeUpdaterTest.cpp
index e123ba847e622..ee74b8a540542 100644
--- a/llvm/unittests/CodeGen/MachineDomTreeUpdaterTest.cpp
+++ b/llvm/unittests/CodeGen/MachineDomTreeUpdaterTest.cpp
@@ -179,7 +179,6 @@ body: |
DTU.deleteBB(&*BB4);
EXPECT_EQ(BB1->succ_size(), 1u);
ASSERT_TRUE(DT.dominates(&*BB1, &*BB2));
- ASSERT_EQ(DT.getNode(&*BB4), nullptr);
}
TEST_F(MachineDomTreeUpdaterTest, LazyUpdateBasicOperations) {
@@ -268,9 +267,9 @@ body: |
ASSERT_TRUE(DT.dominates(&*BB1, &*BB4));
BB1->removeSuccessor(&*BB4);
DTU.deleteBB(&*BB4);
+ ASSERT_TRUE(DTU.hasPendingDeletedBB());
EXPECT_EQ(BB1->succ_size(), 1u);
ASSERT_TRUE(DT.dominates(&*BB1, &*BB2));
ASSERT_NE(DT.getNode(&*BB4), nullptr);
DTU.flush();
- ASSERT_EQ(DT.getNode(&*BB4), nullptr);
}
More information about the llvm-commits
mailing list