[llvm] [AVR] Remove unnecessary casts (NFC) (PR #155791)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 28 01:53:21 PDT 2025


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

getSubtargetImpl() already returns const AVRSubtarget *.


>From 00c6927e7124f335bd750ac213784f240205ba4c Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 27 Aug 2025 08:38:02 -0700
Subject: [PATCH] [AVR] Remove unnecessary casts (NFC)

getSubtargetImpl() already returns const AVRSubtarget *.
---
 llvm/lib/Target/AVR/AVRAsmPrinter.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Target/AVR/AVRAsmPrinter.cpp b/llvm/lib/Target/AVR/AVRAsmPrinter.cpp
index 0fb33cdcb62d2..ad8f7d8018439 100644
--- a/llvm/lib/Target/AVR/AVRAsmPrinter.cpp
+++ b/llvm/lib/Target/AVR/AVRAsmPrinter.cpp
@@ -245,7 +245,7 @@ void AVRAsmPrinter::emitXXStructor(const DataLayout &DL, const Constant *CV) {
 bool AVRAsmPrinter::doFinalization(Module &M) {
   const TargetLoweringObjectFile &TLOF = getObjFileLowering();
   const AVRTargetMachine &TM = (const AVRTargetMachine &)MMI->getTarget();
-  const AVRSubtarget *SubTM = (const AVRSubtarget *)TM.getSubtargetImpl();
+  const AVRSubtarget *SubTM = TM.getSubtargetImpl();
 
   bool NeedsCopyData = false;
   bool NeedsClearBSS = false;
@@ -294,7 +294,7 @@ bool AVRAsmPrinter::doFinalization(Module &M) {
 
 void AVRAsmPrinter::emitStartOfAsmFile(Module &M) {
   const AVRTargetMachine &TM = (const AVRTargetMachine &)MMI->getTarget();
-  const AVRSubtarget *SubTM = (const AVRSubtarget *)TM.getSubtargetImpl();
+  const AVRSubtarget *SubTM = TM.getSubtargetImpl();
   if (!SubTM)
     return;
 



More information about the llvm-commits mailing list