From b2c0e243c54574485a146a0eb96bb38883a6dc27 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 31 Oct 2009 20:08:37 +0000 Subject: Make blockaddress(@func, null) be valid, and make 'deleting a basic block with a blockaddress still referring to it' replace the invalid blockaddress with a new blockaddress(@func, null) instead of a inttoptr(1). This changes the bitcode encoding format, and still needs codegen support (this should produce a non-zero value, referring to the entry block of the function would also be quite reasonable). llvm-svn: 85678 --- llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp') diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index af0b8ac..e32977d 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -854,7 +854,8 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal, break; } } else if (const BlockAddress *BA = dyn_cast(C)) { - assert(BA->getFunction() == BA->getBasicBlock()->getParent() && + assert((!BA->getBasicBlock() || + BA->getFunction() == BA->getBasicBlock()->getParent()) && "Malformed blockaddress"); Code = bitc::CST_CODE_BLOCKADDRESS; Record.push_back(VE.getTypeID(BA->getFunction()->getType())); -- cgit v1.1