[llvm] cf7d8fd - [MemoryBuiltins] Remove AlignedAllocLike (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 9 03:36:35 PST 2022


Author: Nikita Popov
Date: 2022-12-09T12:36:27+01:00
New Revision: cf7d8fd73c856afb2d0b6c8bda4c2e1ad1b639fe

URL: https://github.com/llvm/llvm-project/commit/cf7d8fd73c856afb2d0b6c8bda4c2e1ad1b639fe
DIFF: https://github.com/llvm/llvm-project/commit/cf7d8fd73c856afb2d0b6c8bda4c2e1ad1b639fe.diff

LOG: [MemoryBuiltins] Remove AlignedAllocLike (NFC)

All functions that formerly had this AllocType now use allocator
attributes, so drop it.

Added: 
    

Modified: 
    llvm/lib/Analysis/MemoryBuiltins.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/MemoryBuiltins.cpp b/llvm/lib/Analysis/MemoryBuiltins.cpp
index b205da1025f02..3920095a6be4f 100644
--- a/llvm/lib/Analysis/MemoryBuiltins.cpp
+++ b/llvm/lib/Analysis/MemoryBuiltins.cpp
@@ -54,11 +54,10 @@ using namespace llvm;
 enum AllocType : uint8_t {
   OpNewLike          = 1<<0, // allocates; never returns null
   MallocLike         = 1<<1, // allocates; may return null
-  AlignedAllocLike   = 1<<2, // allocates with alignment; may return null
-  CallocLike         = 1<<3, // allocates + bzero
-  StrDupLike         = 1<<4,
+  CallocLike         = 1<<2, // allocates + bzero
+  StrDupLike         = 1<<3,
   MallocOrOpNewLike  = MallocLike | OpNewLike,
-  MallocOrCallocLike = MallocLike | OpNewLike | CallocLike | AlignedAllocLike,
+  MallocOrCallocLike = MallocLike | OpNewLike | CallocLike,
   AllocLike          = MallocOrCallocLike | StrDupLike,
   AnyAlloc           = AllocLike
 };
@@ -310,12 +309,6 @@ static bool isMallocLikeFn(const Value *V, const TargetLibraryInfo *TLI) {
   return getAllocationData(V, MallocOrOpNewLike, TLI).has_value();
 }
 
-/// Tests if a value is a call or invoke to a library function that
-/// allocates uninitialized memory with alignment (such as aligned_alloc).
-static bool isAlignedAllocLikeFn(const Value *V, const TargetLibraryInfo *TLI) {
-  return getAllocationData(V, AlignedAllocLike, TLI).has_value();
-}
-
 /// Tests if a value is a call or invoke to a library function that
 /// allocates zero-filled memory (such as calloc).
 static bool isCallocLikeFn(const Value *V, const TargetLibraryInfo *TLI) {
@@ -453,8 +446,8 @@ Constant *llvm::getInitialValueOfAllocation(const Value *V,
   if (!Alloc)
     return nullptr;
 
-  // malloc and aligned_alloc are uninitialized (undef)
-  if (isMallocLikeFn(Alloc, TLI) || isAlignedAllocLikeFn(Alloc, TLI))
+  // malloc are uninitialized (undef)
+  if (isMallocLikeFn(Alloc, TLI))
     return UndefValue::get(Ty);
 
   // calloc zero initializes


        


More information about the llvm-commits mailing list