[llvm] [CodeGen] Remove an unnecessary cast (NFC) (PR #150784)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 26 11:06:36 PDT 2025


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

createTargetMachine() already returns TargetMachine *.


>From f2d409e3e7ff5aff80b173def398779b30b676e4 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 24 Jul 2025 18:34:50 -0700
Subject: [PATCH] [CodeGen] Remove an unnecessary cast (NFC)

createTargetMachine() already returns TargetMachine *.
---
 llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp b/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp
index 36504f50505a4..e72b4e4aea49f 100644
--- a/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp
+++ b/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp
@@ -39,8 +39,7 @@ createTargetMachine(std::string TargetStr, StringRef CPU, StringRef FS) {
     return nullptr;
   TargetOptions Options;
   return std::unique_ptr<TargetMachine>(
-      static_cast<TargetMachine *>(T->createTargetMachine(
-          TT, CPU, FS, Options, std::nullopt, std::nullopt)));
+      T->createTargetMachine(TT, CPU, FS, Options, std::nullopt, std::nullopt));
 }
 
 std::unique_ptr<Module> parseMIR(const TargetMachine &TM, StringRef MIRCode,



More information about the llvm-commits mailing list