[llvm] [AsmPrinter] Remove an unnecessary cast (NFC) (PR #150839)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 27 09:27:45 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/150839

getLabelAfterInsn() already returns MCSymbol *.


>From 822c3fd6516eaf50e41fb65f426839196dbcd576 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 27 Jul 2025 08:05:08 -0700
Subject: [PATCH] [AsmPrinter] Remove an unnecessary cast (NFC)

getLabelAfterInsn() already returns MCSymbol *.
---
 llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 11b85763a3fb1..71888332a6620 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -972,10 +972,9 @@ void DwarfDebug::constructCallSiteEntryDIEs(const DISubprogram &SP,
       // the call graph which could lead to some target function. For tail
       // calls, no return PC information is needed, unless tuning for GDB in
       // DWARF4 mode in which case we fake a return PC for compatibility.
-      const MCSymbol *PCAddr =
-          (!IsTail || CU.useGNUAnalogForDwarf5Feature())
-              ? const_cast<MCSymbol *>(getLabelAfterInsn(TopLevelCallMI))
-              : nullptr;
+      const MCSymbol *PCAddr = (!IsTail || CU.useGNUAnalogForDwarf5Feature())
+                                   ? getLabelAfterInsn(TopLevelCallMI)
+                                   : nullptr;
 
       // For tail calls, it's necessary to record the address of the branch
       // instruction so that the debugger can show where the tail call occurred.



More information about the llvm-commits mailing list