From cdfc940912d56a63b6f12eaa7f3faf79cf74c693 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 1 Nov 2009 01:27:45 +0000 Subject: Revert 85678/85680. The decision is to stay with the current form of indirectbr, thus we don't need "blockaddr(@func, null)". Eliminate it for simplicity. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85699 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bitcode/Reader/BitcodeReader.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/Bitcode/Reader') diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 749f16f..68527e3 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -2274,12 +2274,11 @@ bool BitcodeReader::ParseFunctionBody(Function *F) { std::vector &RefList = BAFRI->second; for (unsigned i = 0, e = RefList.size(); i != e; ++i) { unsigned BlockIdx = RefList[i].first; - if (BlockIdx > FunctionBBs.size()) + if (BlockIdx >= FunctionBBs.size()) return Error("Invalid blockaddress block #"); GlobalVariable *FwdRef = RefList[i].second; - BasicBlock *BB = BlockIdx == 0 ? 0 : FunctionBBs[BlockIdx-1]; - FwdRef->replaceAllUsesWith(BlockAddress::get(F, BB)); + FwdRef->replaceAllUsesWith(BlockAddress::get(F, FunctionBBs[BlockIdx])); FwdRef->eraseFromParent(); } -- cgit v1.1