[llvm] 83338d5 - [MemoryBuiltins] [NFC] Add missing section comments
Bryce Wilson via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 13 17:43:50 PST 2022
Author: Bryce Wilson
Date: 2022-01-13T17:43:43-08:00
New Revision: 83338d5032424741accb1e851408021b47b84c08
URL: https://github.com/llvm/llvm-project/commit/83338d5032424741accb1e851408021b47b84c08
DIFF: https://github.com/llvm/llvm-project/commit/83338d5032424741accb1e851408021b47b84c08.diff
LOG: [MemoryBuiltins] [NFC] Add missing section comments
Added:
Modified:
llvm/include/llvm/Analysis/MemoryBuiltins.h
llvm/lib/Analysis/MemoryBuiltins.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/MemoryBuiltins.h b/llvm/include/llvm/Analysis/MemoryBuiltins.h
index 858a3eddca387..5daa46267f5f3 100644
--- a/llvm/include/llvm/Analysis/MemoryBuiltins.h
+++ b/llvm/include/llvm/Analysis/MemoryBuiltins.h
@@ -49,6 +49,10 @@ class Type;
class UndefValue;
class Value;
+//===----------------------------------------------------------------------===//
+// Properties of allocation functions
+//
+
/// Tests if a value is a call or invoke to a library function that
/// allocates or reallocates memory (either malloc, calloc, realloc, or strdup
/// like).
@@ -78,20 +82,6 @@ bool isReallocLikeFn(const Value *V, const TargetLibraryInfo *TLI);
/// reallocates memory (e.g., realloc).
bool isReallocLikeFn(const Function *F, const TargetLibraryInfo *TLI);
-//===----------------------------------------------------------------------===//
-// free Call Utility Functions.
-//
-
-/// isLibFreeFunction - Returns true if the function is a builtin free()
-bool isLibFreeFunction(const Function *F, const LibFunc TLIFn);
-
-/// isFreeCall - Returns non-null if the value is a call to the builtin free()
-const CallInst *isFreeCall(const Value *I, const TargetLibraryInfo *TLI);
-
-inline CallInst *isFreeCall(Value *I, const TargetLibraryInfo *TLI) {
- return const_cast<CallInst*>(isFreeCall((const Value*)I, TLI));
-}
-
//===----------------------------------------------------------------------===//
// Properties of allocation functions
//
@@ -123,6 +113,20 @@ Constant *getInitialValueOfAllocation(const CallBase *Alloc,
const TargetLibraryInfo *TLI,
Type *Ty);
+//===----------------------------------------------------------------------===//
+// free Call Utility Functions.
+//
+
+/// isLibFreeFunction - Returns true if the function is a builtin free()
+bool isLibFreeFunction(const Function *F, const LibFunc TLIFn);
+
+/// isFreeCall - Returns non-null if the value is a call to the builtin free()
+const CallInst *isFreeCall(const Value *I, const TargetLibraryInfo *TLI);
+
+inline CallInst *isFreeCall(Value *I, const TargetLibraryInfo *TLI) {
+ return const_cast<CallInst*>(isFreeCall((const Value*)I, TLI));
+}
+
//===----------------------------------------------------------------------===//
// Utility functions to compute size of objects.
//
diff --git a/llvm/lib/Analysis/MemoryBuiltins.cpp b/llvm/lib/Analysis/MemoryBuiltins.cpp
index af8cb78b9a567..9299b53aaf694 100644
--- a/llvm/lib/Analysis/MemoryBuiltins.cpp
+++ b/llvm/lib/Analysis/MemoryBuiltins.cpp
@@ -223,6 +223,10 @@ static Optional<AllocFnsTy> getAllocationSize(const Value *V,
return Result;
}
+
+//===----------------------------------------------------------------------===//
+// Properties of allocation functions
+//
/// Tests if a value is a call or invoke to a library function that
/// allocates or reallocates memory (either malloc, calloc, realloc, or strdup
/// like).
@@ -282,6 +286,10 @@ bool llvm::isReallocLikeFn(const Function *F, const TargetLibraryInfo *TLI) {
return getAllocationDataForFunction(F, ReallocLike, TLI).hasValue();
}
+
+//===----------------------------------------------------------------------===//
+// Properties of allocation functions
+//
bool llvm::isAllocRemovable(const CallBase *CB, const TargetLibraryInfo *TLI) {
assert(isAllocationFn(CB, TLI));
@@ -400,6 +408,10 @@ Constant *llvm::getInitialValueOfAllocation(const CallBase *Alloc,
return nullptr;
}
+
+//===----------------------------------------------------------------------===//
+// free Call Utility Functions.
+//
/// isLibFreeFunction - Returns true if the function is a builtin free()
bool llvm::isLibFreeFunction(const Function *F, const LibFunc TLIFn) {
unsigned ExpectedNumParams;
More information about the llvm-commits
mailing list