[llvm] [BOLT][DWARF][NFC] Remove unused check. (PR #99237)

Alexander Yermolovich via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 16 13:34:12 PDT 2024


https://github.com/ayermolo created https://github.com/llvm/llvm-project/pull/99237

This is a followup for:
https://github.com/llvm/llvm-project/commit/9dab91247d5c40607617f13b8fe5056111dd3045
Looking at this code more I don't think the check is really necessary.


>From 2a19d4abbb6d8eb42054b334f2268f6e853ae630 Mon Sep 17 00:00:00 2001
From: Alexander Yermolovich <ayermolo at meta.com>
Date: Tue, 16 Jul 2024 13:31:35 -0700
Subject: [PATCH] [BOLT][DWARF][NFC] Remove unused check.

This is a followup for:
https://github.com/llvm/llvm-project/commit/9dab91247d5c40607617f13b8fe5056111dd3045
Looking at this code more I don't think the check is really necessary.
---
 bolt/lib/Core/DIEBuilder.cpp | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/bolt/lib/Core/DIEBuilder.cpp b/bolt/lib/Core/DIEBuilder.cpp
index 7815a305c0518..d896681da63b8 100644
--- a/bolt/lib/Core/DIEBuilder.cpp
+++ b/bolt/lib/Core/DIEBuilder.cpp
@@ -617,14 +617,6 @@ void DIEBuilder::cloneDieReferenceAttribute(
     DIE &Die, const DWARFUnit &U, const DWARFDie &InputDIE,
     const DWARFAbbreviationDeclaration::AttributeSpec AttrSpec,
     const DWARFFormValue &Val) {
-  uint64_t Ref;
-  if (std::optional<uint64_t> Off = Val.getAsRelativeReference())
-    Ref = Val.getUnit()->getOffset() + *Off;
-  else if (Off = Val.getAsDebugInfoReference(); Off)
-    Ref = *Off;
-  else
-    return;
-
   DIE *NewRefDie = nullptr;
   DWARFUnit *RefUnit = nullptr;
 
@@ -641,8 +633,6 @@ void DIEBuilder::cloneDieReferenceAttribute(
   DIEInfo &DieInfo = getDIEInfo(*UnitId, DIEId);
 
   if (!DieInfo.Die) {
-    assert(Ref > InputDIE.getOffset());
-    (void)Ref;
     BC.errs() << "BOLT-WARNING: [internal-dwarf-error]: encounter unexpected "
                  "unallocated DIE. Should be alloc!\n";
     // We haven't cloned this DIE yet. Just create an empty one and



More information about the llvm-commits mailing list