[llvm] [Analysis] Remove unnecessary casts (NFC) (PR #146216)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 28 08:46:01 PDT 2025


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

PImpl is already of LazyValueInfoImpl *.


>From d70feb8cd347abde76d3be538ae6eff194c060e3 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 27 Jun 2025 22:56:16 -0700
Subject: [PATCH] [Analysis] Remove unnecessary casts (NFC)

PImpl is already of LazyValueInfoImpl *.
---
 llvm/lib/Analysis/LazyValueInfo.cpp | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp
index 2a562484fc374..922f25de54e9d 100644
--- a/llvm/lib/Analysis/LazyValueInfo.cpp
+++ b/llvm/lib/Analysis/LazyValueInfo.cpp
@@ -1745,14 +1745,10 @@ LazyValueInfoImpl &LazyValueInfo::getOrCreateImpl(const Module *M) {
         Intrinsic::getDeclarationIfExists(M, Intrinsic::experimental_guard);
     PImpl = new LazyValueInfoImpl(AC, DL, GuardDecl);
   }
-  return *static_cast<LazyValueInfoImpl *>(PImpl);
+  return *PImpl;
 }
 
-LazyValueInfoImpl *LazyValueInfo::getImpl() {
-  if (!PImpl)
-    return nullptr;
-  return static_cast<LazyValueInfoImpl *>(PImpl);
-}
+LazyValueInfoImpl *LazyValueInfo::getImpl() { return PImpl; }
 
 LazyValueInfo::~LazyValueInfo() { releaseMemory(); }
 



More information about the llvm-commits mailing list