Skip to content

Commit cf7d8fd

Browse files
committed
[MemoryBuiltins] Remove AlignedAllocLike (NFC)
All functions that formerly had this AllocType now use allocator attributes, so drop it.
1 parent edd5d77 commit cf7d8fd

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

llvm/lib/Analysis/MemoryBuiltins.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,10 @@ using namespace llvm;
5454
enum AllocType : uint8_t {
5555
OpNewLike = 1<<0, // allocates; never returns null
5656
MallocLike = 1<<1, // allocates; may return null
57-
AlignedAllocLike = 1<<2, // allocates with alignment; may return null
58-
CallocLike = 1<<3, // allocates + bzero
59-
StrDupLike = 1<<4,
57+
CallocLike = 1<<2, // allocates + bzero
58+
StrDupLike = 1<<3,
6059
MallocOrOpNewLike = MallocLike | OpNewLike,
61-
MallocOrCallocLike = MallocLike | OpNewLike | CallocLike | AlignedAllocLike,
60+
MallocOrCallocLike = MallocLike | OpNewLike | CallocLike,
6261
AllocLike = MallocOrCallocLike | StrDupLike,
6362
AnyAlloc = AllocLike
6463
};
@@ -310,12 +309,6 @@ static bool isMallocLikeFn(const Value *V, const TargetLibraryInfo *TLI) {
310309
return getAllocationData(V, MallocOrOpNewLike, TLI).has_value();
311310
}
312311

313-
/// Tests if a value is a call or invoke to a library function that
314-
/// allocates uninitialized memory with alignment (such as aligned_alloc).
315-
static bool isAlignedAllocLikeFn(const Value *V, const TargetLibraryInfo *TLI) {
316-
return getAllocationData(V, AlignedAllocLike, TLI).has_value();
317-
}
318-
319312
/// Tests if a value is a call or invoke to a library function that
320313
/// allocates zero-filled memory (such as calloc).
321314
static bool isCallocLikeFn(const Value *V, const TargetLibraryInfo *TLI) {
@@ -453,8 +446,8 @@ Constant *llvm::getInitialValueOfAllocation(const Value *V,
453446
if (!Alloc)
454447
return nullptr;
455448

456-
// malloc and aligned_alloc are uninitialized (undef)
457-
if (isMallocLikeFn(Alloc, TLI) || isAlignedAllocLikeFn(Alloc, TLI))
449+
// malloc are uninitialized (undef)
450+
if (isMallocLikeFn(Alloc, TLI))
458451
return UndefValue::get(Ty);
459452

460453
// calloc zero initializes

0 commit comments

Comments
 (0)