Skip to content

Commit 3a7876d

Browse files
[llvm] Delete pointers without null checks (NFC) (#168183)
Identified with readability-delete-null-pointer.
1 parent 7a8237b commit 3a7876d

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

llvm/include/llvm/ADT/ConcurrentHashtable.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,8 @@ class ConcurrentHashTableByPtr {
342342
CurBucket.Size = NewBucketSize;
343343

344344
// Delete old bucket entries.
345-
if (SrcHashes != nullptr)
346-
delete[] SrcHashes;
347-
if (SrcEntries != nullptr)
348-
delete[] SrcEntries;
345+
delete[] SrcHashes;
346+
delete[] SrcEntries;
349347
}
350348

351349
uint32_t getBucketIdx(hash_code Hash) { return Hash & HashMask; }

llvm/lib/Target/Hexagon/HexagonHazardRecognizer.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ class HexagonHazardRecognizer : public ScheduleHazardRecognizer {
5050
const HexagonSubtarget &ST)
5151
: Resources(ST.createDFAPacketizer(II)), TII(HII) { }
5252

53-
~HexagonHazardRecognizer() override {
54-
if (Resources)
55-
delete Resources;
56-
}
53+
~HexagonHazardRecognizer() override { delete Resources; }
5754

5855
/// This callback is invoked when a new block of instructions is about to be
5956
/// scheduled. The hazard state is set to an initialized state.

llvm/lib/Transforms/Vectorize/VPlan.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,8 +884,7 @@ VPlan::~VPlan() {
884884
}
885885
for (VPValue *VPV : getLiveIns())
886886
delete VPV;
887-
if (BackedgeTakenCount)
888-
delete BackedgeTakenCount;
887+
delete BackedgeTakenCount;
889888
}
890889

891890
VPIRBasicBlock *VPlan::getExitBlock(BasicBlock *IRBB) const {

0 commit comments

Comments
 (0)