diff options
| author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-02-16 19:18:01 +0000 |
|---|---|---|
| committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-02-16 19:18:01 +0000 |
| commit | 060ee625b8a72cf4b85958e2e6d895d509403306 (patch) | |
| tree | 912b8231c86ede31853480cb829104c00e2666b6 /llvm/lib/Bitcode/Reader/BitcodeReader.h | |
| parent | 8b77454dff820832259acefe45e4254203760f19 (diff) | |
| download | bcm5719-llvm-060ee625b8a72cf4b85958e2e6d895d509403306.tar.gz bcm5719-llvm-060ee625b8a72cf4b85958e2e6d895d509403306.zip | |
Bitcode: Fix major regression: large files w/ debug info
The metadata/value split introduced a major regression reading large
bitcode files that contain debug info (or other cyclic (non-self
reference) metadata graphs). For the first time in a while, I dropped
from libLTO.dylib down to `llvm-lto` with a non-trivial bitcode file
(~350MB), and I hit this when reading the result of ld64's `-save-temps`
in `llvm-lto`.
Here's pseudo-code for what was going on:
read-main-metadata-block:
for each md:
if has-fwd-ref: // Only true for cyclic graphs.
any-fwd-refs <- true
if any-fwd-refs:
foreach md:
resolve-cycles(md) // Handle cycles.
foreach function:
read-function-metadata-block: // Such as !alias, !loop
if any-fwd-refs:
foreach md: // (all metadata, not just this block)
resolve-cycles(md) // A no-op, but the loop is expensive!!
This commit resets the `AnyFwdRefs` flag to `false`. This on its own
was enough to change my Release+Asserts `llvm-lto` time for reading this
bitcode from over 20 minutes (I gave up on it) to 20 seconds. I've gone
further by tracking the min/max metadata forward-references in a
metadata block. This protects against a schema that has lots of
functions that each reference their own metadata cycle.
Unfortunately, this regression is in the 3.6 branch as well.
llvm-svn: 229421
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.h')
| -rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.h b/llvm/lib/Bitcode/Reader/BitcodeReader.h index 7f7eb70bce9..5090be48450 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.h +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.h @@ -99,6 +99,8 @@ public: class BitcodeReaderMDValueList { unsigned NumFwdRefs; bool AnyFwdRefs; + unsigned MinFwdRef; + unsigned MaxFwdRef; std::vector<TrackingMDRef> MDValuePtrs; LLVMContext &Context; |

