BitcodeWriter: Move abbreviation for DILocation; almost NFC

Simplify ValueEnumerator and WriteModuleMetadata by shifting the logic
for the METADATA_LOCATION abbreviation into WriteDILocation.

The only change is that the abbreviation is emitted later in the
bitcode, just before the first `DILocation` record.  This shouldn't be
observable though.

llvm-svn: 264302
This commit is contained in:
Duncan P. N. Exon Smith
2016-03-24 16:25:51 +00:00
parent f8ecdf5284
commit 625fda2714
3 changed files with 18 additions and 20 deletions

View File

@@ -280,7 +280,7 @@ static bool isIntOrIntVectorValue(const std::pair<const Value*, unsigned> &V) {
ValueEnumerator::ValueEnumerator(const Module &M,
bool ShouldPreserveUseListOrder)
: HasMDString(false), HasDILocation(false), HasGenericDINode(false),
: HasMDString(false), HasGenericDINode(false),
ShouldPreserveUseListOrder(ShouldPreserveUseListOrder) {
if (ShouldPreserveUseListOrder)
UseListOrders = predictUseListOrder(M);
@@ -532,7 +532,6 @@ void ValueEnumerator::EnumerateMetadata(const Metadata *MD) {
EnumerateValue(C->getValue());
HasMDString |= isa<MDString>(MD);
HasDILocation |= isa<DILocation>(MD);
HasGenericDINode |= isa<GenericDINode>(MD);
// Replace the dummy ID inserted above with the correct one. MetadataMap may