From bb738170a9211bd420badcb9cadb0bfa340f1d81 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Mon, 6 Jun 2016 23:21:27 +0000 Subject: Verifier: Simplify and fix issue where we were not verifying unmaterialized functions. Arrange to call verify(Function &) on each function, followed by verify(Module &), whether the verifier is being used from the pass or from verifyModule(). As a side effect, this fixes an issue that caused us not to call verify(Function &) on unmaterialized functions from verifyModule(). Differential Revision: http://reviews.llvm.org/D21042 llvm-svn: 271956 --- llvm/unittests/IR/MetadataTest.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'llvm/unittests/IR') diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp index a36e131b4bc..d3db053c099 100644 --- a/llvm/unittests/IR/MetadataTest.cpp +++ b/llvm/unittests/IR/MetadataTest.cpp @@ -2253,7 +2253,12 @@ TEST_F(FunctionAttachmentTest, Verifier) { // be verified directly, so check that the module fails to verify). EXPECT_TRUE(verifyModule(*F->getParent())); + // Nor can materializable functions. + F->setIsMaterializable(true); + EXPECT_TRUE(verifyModule(*F->getParent())); + // Functions with a body can. + F->setIsMaterializable(false); (void)new UnreachableInst(Context, BasicBlock::Create(Context, "bb", F)); EXPECT_FALSE(verifyModule(*F->getParent())); EXPECT_FALSE(verifyFunction(*F)); -- cgit v1.2.3