Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

Identified with readability-delete-null-pointer.

Identified with readability-delete-null-pointer.
@llvmbot
Copy link
Member

llvmbot commented Nov 15, 2025

@llvm/pr-subscribers-vectorizers
@llvm/pr-subscribers-llvm-adt
@llvm/pr-subscribers-backend-hexagon

@llvm/pr-subscribers-llvm-transforms

Author: Kazu Hirata (kazutakahirata)

Changes

Identified with readability-delete-null-pointer.


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

3 Files Affected:

  • (modified) llvm/include/llvm/ADT/ConcurrentHashtable.h (+2-4)
  • (modified) llvm/lib/Target/Hexagon/HexagonHazardRecognizer.h (+1-4)
  • (modified) llvm/lib/Transforms/Vectorize/VPlan.cpp (+1-2)
diff --git a/llvm/include/llvm/ADT/ConcurrentHashtable.h b/llvm/include/llvm/ADT/ConcurrentHashtable.h
index 9ee5f594ea56a..4e27bc48f9d1f 100644
--- a/llvm/include/llvm/ADT/ConcurrentHashtable.h
+++ b/llvm/include/llvm/ADT/ConcurrentHashtable.h
@@ -342,10 +342,8 @@ class ConcurrentHashTableByPtr {
     CurBucket.Size = NewBucketSize;
 
     // Delete old bucket entries.
-    if (SrcHashes != nullptr)
-      delete[] SrcHashes;
-    if (SrcEntries != nullptr)
-      delete[] SrcEntries;
+    delete[] SrcHashes;
+    delete[] SrcEntries;
   }
 
   uint32_t getBucketIdx(hash_code Hash) { return Hash & HashMask; }
diff --git a/llvm/lib/Target/Hexagon/HexagonHazardRecognizer.h b/llvm/lib/Target/Hexagon/HexagonHazardRecognizer.h
index 0528cbd1f15f5..683feb11c1422 100644
--- a/llvm/lib/Target/Hexagon/HexagonHazardRecognizer.h
+++ b/llvm/lib/Target/Hexagon/HexagonHazardRecognizer.h
@@ -50,10 +50,7 @@ class HexagonHazardRecognizer : public ScheduleHazardRecognizer {
                           const HexagonSubtarget &ST)
     : Resources(ST.createDFAPacketizer(II)), TII(HII) { }
 
-  ~HexagonHazardRecognizer() override {
-    if (Resources)
-      delete Resources;
-  }
+  ~HexagonHazardRecognizer() override { delete Resources; }
 
   /// This callback is invoked when a new block of instructions is about to be
   /// scheduled. The hazard state is set to an initialized state.
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index 62dacf912e210..f99f51d5846cf 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -884,8 +884,7 @@ VPlan::~VPlan() {
   }
   for (VPValue *VPV : getLiveIns())
     delete VPV;
-  if (BackedgeTakenCount)
-    delete BackedgeTakenCount;
+  delete BackedgeTakenCount;
 }
 
 VPIRBasicBlock *VPlan::getExitBlock(BasicBlock *IRBB) const {

@kazutakahirata kazutakahirata merged commit 3a7876d into llvm:main Nov 15, 2025
15 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20251114_clang_tidy_readability-delete-null-pointer branch November 15, 2025 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants