[llvm] 83338d5 - [MemoryBuiltins] [NFC] Add missing section comments
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 14 08:36:10 PST 2022
I reverted this change.
Two issues:
* Repeating comments in source files is non-idiomatic. This
particular source file has a bunch of them, but we shouldn't be
adding more.
* The isXLike functions are *not* properties of allocations. They are
groupings of known allocation functions. That distinction is
important, and not one I want to loose. It's the whole focus of a
bunch of recent patches in fact.
On 1/13/22 5:43 PM, Bryce Wilson via llvm-commits wrote:
> 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;
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220114/dbaf1862/attachment.html>
More information about the llvm-commits
mailing list