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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-bolt

Author: Alexander Yermolovich (ayermolo)

<details>
<summary>Changes</summary>

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.


---
Full diff: https://github.com/llvm/llvm-project/pull/99237.diff


1 Files Affected:

- (modified) bolt/lib/Core/DIEBuilder.cpp (-10) 


``````````diff
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

``````````

</details>


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


More information about the llvm-commits mailing list