diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-05-29 16:25:25 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-05-29 16:25:25 +0000 | 
| commit | ab44ce3d598882e51a25eb82eb7ae6308de85ae6 (patch) | |
| tree | 568d786a59d49bef961dcb9bd09d422701b9da5b /lib/Bitcode/Writer | |
| parent | b5630dbadf9a2a06754194387d6b0fd9962a67f1 (diff) | |
Notes
Diffstat (limited to 'lib/Bitcode/Writer')
| -rw-r--r-- | lib/Bitcode/Writer/BitcodeWriter.cpp | 34 | ||||
| -rw-r--r-- | lib/Bitcode/Writer/ValueEnumerator.cpp | 7 | 
2 files changed, 12 insertions, 29 deletions
| diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index 1f8b50342c2d..c1d81ac203a1 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -660,10 +660,12 @@ void ModuleBitcodeWriter::writeAttributeTable() {    SmallVector<uint64_t, 64> Record;    for (unsigned i = 0, e = Attrs.size(); i != e; ++i) { -    const AttributeList &A = Attrs[i]; -    for (unsigned i = 0, e = A.getNumSlots(); i != e; ++i) -      Record.push_back( -          VE.getAttributeGroupID({A.getSlotIndex(i), A.getSlotAttributes(i)})); +    AttributeList AL = Attrs[i]; +    for (unsigned i = AL.index_begin(), e = AL.index_end(); i != e; ++i) { +      AttributeSet AS = AL.getAttributes(i); +      if (AS.hasAttributes()) +        Record.push_back(VE.getAttributeGroupID({i, AS})); +    }      Stream.EmitRecord(bitc::PARAMATTR_CODE_ENTRY, Record);      Record.clear(); @@ -3413,30 +3415,8 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() {    // Create value IDs for undefined references.    forEachSummary([&](GVInfo I) { -    if (auto *VS = dyn_cast<GlobalVarSummary>(I.second)) { -      for (auto &RI : VS->refs()) -        assignValueId(RI.getGUID()); -      return; -    } - -    auto *FS = dyn_cast<FunctionSummary>(I.second); -    if (!FS) -      return; -    for (auto &RI : FS->refs()) +    for (auto &RI : I.second->refs())        assignValueId(RI.getGUID()); - -    for (auto &EI : FS->calls()) { -      GlobalValue::GUID GUID = EI.first.getGUID(); -      if (!hasValueId(GUID)) { -        // For SamplePGO, the indirect call targets for local functions will -        // have its original name annotated in profile. We try to find the -        // corresponding PGOFuncName as the GUID. -        GUID = Index.getGUIDFromOriginalID(GUID); -        if (GUID == 0 || !hasValueId(GUID)) -          continue; -      } -      assignValueId(GUID); -    }    });    for (const auto &GVI : valueIds()) { diff --git a/lib/Bitcode/Writer/ValueEnumerator.cpp b/lib/Bitcode/Writer/ValueEnumerator.cpp index fd76400331d9..bb626baabd12 100644 --- a/lib/Bitcode/Writer/ValueEnumerator.cpp +++ b/lib/Bitcode/Writer/ValueEnumerator.cpp @@ -902,8 +902,11 @@ void ValueEnumerator::EnumerateAttributes(AttributeList PAL) {    }    // Do lookups for all attribute groups. -  for (unsigned i = 0, e = PAL.getNumSlots(); i != e; ++i) { -    IndexAndAttrSet Pair = {PAL.getSlotIndex(i), PAL.getSlotAttributes(i)}; +  for (unsigned i = PAL.index_begin(), e = PAL.index_end(); i != e; ++i) { +    AttributeSet AS = PAL.getAttributes(i); +    if (!AS.hasAttributes()) +      continue; +    IndexAndAttrSet Pair = {i, AS};      unsigned &Entry = AttributeGroupMap[Pair];      if (Entry == 0) {        AttributeGroups.push_back(Pair); | 
