[PATCH] D41695: [Metadata] Extend 'count' field of DISubrange to take a metadata node
Adrian Prantl via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 17 10:12:23 PST 2018
aprantl added a comment.
It looks like this changes the layout of DISubrange from
Flags | Count |
================
Comment at: include/llvm/IR/DebugInfoMetadata.h:372
+
+ ConstantInt *getCount() const {
+ if (auto *MD = dyn_cast<ConstantAsMetadata>(getRawCountNode()))
----------------
Perhaps:
`Optional<ConstantInt *> getConstantCount()` ?
================
Comment at: lib/Bitcode/Writer/BitcodeWriter.cpp:1445
Record.push_back(N->isDistinct());
- Record.push_back(N->getCount());
+ Record.push_back(-1); // this field has become obsolete
+ Record.push_back(VE.getMetadataOrNullID(N->getRawCountNode()));
----------------
We typically version bitcode by adding a bit to the flags, like this:
` Record.push_back(N->isDistinct() | 1<<1);`
This way we don't have to waste the space for the obsoleted field.
https://reviews.llvm.org/D41695
More information about the llvm-commits
mailing list