diff options
| author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-08-16 01:54:37 +0000 |
|---|---|---|
| committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-08-16 01:54:37 +0000 |
| commit | 5a5fd7b1b33be5f6c83bf5eda08e0d053805c7da (patch) | |
| tree | fe562eb63f89242c2f46a3efb8fbd574f6d83a31 /llvm/lib/Bitcode/Reader/BitcodeReader.h | |
| parent | 1318364e3e95a0df24c607b478fab7034580618c (diff) | |
| download | llvm-5a5fd7b1b33be5f6c83bf5eda08e0d053805c7da.zip llvm-5a5fd7b1b33be5f6c83bf5eda08e0d053805c7da.tar.gz llvm-5a5fd7b1b33be5f6c83bf5eda08e0d053805c7da.tar.bz2 | |
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
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.h')
| -rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.h | 6 |
1 files changed, 3 insertions, 3 deletions
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<Function*, uint64_t> DeferredFunctionInfo; /// These are basic blocks forward-referenced by block addresses. They are - /// inserted lazily into functions when they're loaded. - typedef std::pair<unsigned, BasicBlock *> BasicBlockRefTy; - DenseMap<Function *, std::vector<BasicBlockRefTy>> BasicBlockFwdRefs; + /// inserted lazily into functions when they're loaded. The basic block ID is + /// its index into the vector. + DenseMap<Function *, std::vector<BasicBlock *>> BasicBlockFwdRefs; std::deque<Function *> BasicBlockFwdRefQueue; /// UseRelativeIDs - Indicates that we are using a new encoding for |
