From 5a5fd7b1b33be5f6c83bf5eda08e0d053805c7da Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Sat, 16 Aug 2014 01:54:37 +0000 Subject: BitcodeReader: Only create one basic block for each blockaddress Block address forward-references are implemented by creating a `BasicBlock` ahead of time that gets inserted in the `Function` when it's eventually encountered. However, if the same blockaddress was used in two separate functions that were parsed *before* the referenced function (and the blockaddress was never used at global scope), two separate basic blocks would get created, one of which would be forgotten creating invalid IR. This commit changes the forward-reference logic to create only one basic block (and always return the same blockaddress). llvm-svn: 215805 --- llvm/lib/Bitcode/Reader/BitcodeReader.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.h') diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.h b/llvm/lib/Bitcode/Reader/BitcodeReader.h index 5bbcaf4..6d4e0a2 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.h +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.h @@ -181,9 +181,9 @@ class BitcodeReader : public GVMaterializer { DenseMap DeferredFunctionInfo; /// These are basic blocks forward-referenced by block addresses. They are - /// inserted lazily into functions when they're loaded. - typedef std::pair BasicBlockRefTy; - DenseMap> BasicBlockFwdRefs; + /// inserted lazily into functions when they're loaded. The basic block ID is + /// its index into the vector. + DenseMap> BasicBlockFwdRefs; std::deque BasicBlockFwdRefQueue; /// UseRelativeIDs - Indicates that we are using a new encoding for -- cgit v1.1