[PATCH] D126958: [Debuginfo][DWARF][NFC] Refactor DwarfStringPoolEntryRef - remove isIndexed().

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 5 11:20:46 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG501d5b24db50: [Debuginfo][DWARF][NFC] Refactor DwarfStringPoolEntryRef - remove isIndexed(). (authored by avl).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126958/new/

https://reviews.llvm.org/D126958

Files:
  llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h
  llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
  llvm/lib/CodeGen/NonRelocatableStringpool.cpp
  llvm/unittests/CodeGen/DIEHashTest.cpp


Index: llvm/unittests/CodeGen/DIEHashTest.cpp
===================================================================
--- llvm/unittests/CodeGen/DIEHashTest.cpp
+++ llvm/unittests/CodeGen/DIEHashTest.cpp
@@ -41,8 +41,8 @@
 public:
   DIEString getString(StringRef S) {
     DwarfStringPoolEntry Entry = {nullptr, 1, 1};
-    return DIEString(DwarfStringPoolEntryRef(
-        *Pool.insert(std::make_pair(S, Entry)).first, Entry.isIndexed()));
+    return DIEString(
+        DwarfStringPoolEntryRef(*Pool.insert(std::make_pair(S, Entry)).first));
   }
 
   AsmPrinter *getAsmPrinter() {
Index: llvm/lib/CodeGen/NonRelocatableStringpool.cpp
===================================================================
--- llvm/lib/CodeGen/NonRelocatableStringpool.cpp
+++ llvm/lib/CodeGen/NonRelocatableStringpool.cpp
@@ -25,7 +25,7 @@
     Entry.Symbol = nullptr;
     CurrentEndOffset += S.size() + 1;
   }
-  return DwarfStringPoolEntryRef(*I.first, true);
+  return DwarfStringPoolEntryRef(*I.first);
 }
 
 StringRef NonRelocatableStringpool::internString(StringRef S) {
@@ -44,7 +44,7 @@
   Result.reserve(Strings.size());
   for (const auto &E : Strings)
     if (E.getValue().isIndexed())
-      Result.emplace_back(E, true);
+      Result.emplace_back(E);
   llvm::sort(Result, [](const DwarfStringPoolEntryRef A,
                         const DwarfStringPoolEntryRef B) {
     return A.getIndex() < B.getIndex();
Index: llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfStringPool.cpp
@@ -39,7 +39,7 @@
 DwarfStringPool::EntryRef DwarfStringPool::getEntry(AsmPrinter &Asm,
                                                     StringRef Str) {
   auto &MapEntry = getEntryImpl(Asm, Str);
-  return EntryRef(MapEntry, false);
+  return EntryRef(MapEntry);
 }
 
 DwarfStringPool::EntryRef DwarfStringPool::getIndexedEntry(AsmPrinter &Asm,
@@ -47,7 +47,7 @@
   auto &MapEntry = getEntryImpl(Asm, Str);
   if (!MapEntry.getValue().isIndexed())
     MapEntry.getValue().Index = NumIndexedStrings++;
-  return EntryRef(MapEntry, true);
+  return EntryRef(MapEntry);
 }
 
 void DwarfStringPool::emitStringOffsetsTableHeader(AsmPrinter &Asm,
Index: llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h
===================================================================
--- llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h
+++ llvm/include/llvm/CodeGen/DwarfStringPoolEntry.h
@@ -29,18 +29,16 @@
 
 /// String pool entry reference.
 class DwarfStringPoolEntryRef {
-  PointerIntPair<const StringMapEntry<DwarfStringPoolEntry> *, 1, bool>
-      MapEntryAndIndexed;
+  const StringMapEntry<DwarfStringPoolEntry> *MapEntry = nullptr;
 
   const StringMapEntry<DwarfStringPoolEntry> *getMapEntry() const {
-    return MapEntryAndIndexed.getPointer();
+    return MapEntry;
   }
 
 public:
   DwarfStringPoolEntryRef() = default;
-  DwarfStringPoolEntryRef(const StringMapEntry<DwarfStringPoolEntry> &Entry,
-                          bool Indexed)
-      : MapEntryAndIndexed(&Entry, Indexed) {}
+  DwarfStringPoolEntryRef(const StringMapEntry<DwarfStringPoolEntry> &Entry)
+      : MapEntry(&Entry) {}
 
   explicit operator bool() const { return getMapEntry(); }
   MCSymbol *getSymbol() const {
@@ -48,9 +46,7 @@
     return getMapEntry()->second.Symbol;
   }
   uint64_t getOffset() const { return getMapEntry()->second.Offset; }
-  bool isIndexed() const { return MapEntryAndIndexed.getInt(); }
   unsigned getIndex() const {
-    assert(isIndexed());
     assert(getMapEntry()->getValue().isIndexed());
     return getMapEntry()->second.Index;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126958.434341.patch
Type: text/x-patch
Size: 3690 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220605/461d97af/attachment.bin>


More information about the llvm-commits mailing list