Skip to content

[Analysis] Remove unnecessary casts (NFC) #146216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

kazutakahirata
Copy link
Contributor

PImpl is already of LazyValueInfoImpl *.

PImpl is already of LazyValueInfoImpl *.
@kazutakahirata kazutakahirata requested a review from nikic as a code owner June 28, 2025 15:45
@llvmbot llvmbot added the llvm:analysis Includes value tracking, cost tables and constant folding label Jun 28, 2025
@llvmbot
Copy link
Member

llvmbot commented Jun 28, 2025

@llvm/pr-subscribers-llvm-analysis

Author: Kazu Hirata (kazutakahirata)

Changes

PImpl is already of LazyValueInfoImpl *.


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

1 Files Affected:

  • (modified) llvm/lib/Analysis/LazyValueInfo.cpp (+2-6)
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(); }
 

@kazutakahirata kazutakahirata merged commit 25d7fd3 into llvm:main Jun 28, 2025
9 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250628_cast_llvm_Analysis branch June 28, 2025 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm:analysis Includes value tracking, cost tables and constant folding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants