[PATCH] D38540: Ignore duplicated, identical fragment declarations

Björn Steinbrink via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 4 07:10:19 PDT 2017


dotdash created this revision.
Herald added a subscriber: JDevlieghere.

Some passes might duplicate calls to llvm.dbg.declare causing
duplicated, identical fragment declarations which currently cause an
assertion might is meant to catch erroneous overlapping fragment
declarations. But for declarations that are simply duplicated we can be
a bit more lenient and just ignore the duplicates.

PR33157 was fixed by a similar change for non-fragment declarations in
r305244.


https://reviews.llvm.org/D38540

Files:
  lib/CodeGen/AsmPrinter/DwarfDebug.cpp


Index: lib/CodeGen/AsmPrinter/DwarfDebug.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -220,6 +220,13 @@
               return A.Expr->getFragmentInfo()->OffsetInBits <
                      B.Expr->getFragmentInfo()->OffsetInBits;
             });
+
+  auto last = std::unique(FrameIndexExprs.begin(), FrameIndexExprs.end(),
+      [](const FrameIndexExpr &A, const FrameIndexExpr &B) -> bool {
+        return A.FI == B.FI && A.Expr == B.Expr;
+      });
+  FrameIndexExprs.erase(last, FrameIndexExprs.end());
+
   return FrameIndexExprs;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38540.117671.patch
Type: text/x-patch
Size: 659 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171004/917e6f37/attachment-0001.bin>


More information about the llvm-commits mailing list