<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>I reverted this change.</p>
<p>Two issues:</p>
<ul>
<li>Repeating comments in source files is non-idiomatic. This
particular source file has a bunch of them, but we shouldn't be
adding more.</li>
<li>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. <br>
</li>
</ul>
<div class="moz-cite-prefix">On 1/13/22 5:43 PM, Bryce Wilson via
llvm-commits wrote:<br>
</div>
<blockquote type="cite"
cite="mid:61e0d556.1c69fb81.6fbc5.bdc8@mx.google.com">
<pre class="moz-quote-pre" wrap="">
Author: Bryce Wilson
Date: 2022-01-13T17:43:43-08:00
New Revision: 83338d5032424741accb1e851408021b47b84c08
URL: <a class="moz-txt-link-freetext" href="https://github.com/llvm/llvm-project/commit/83338d5032424741accb1e851408021b47b84c08">https://github.com/llvm/llvm-project/commit/83338d5032424741accb1e851408021b47b84c08</a>
DIFF: <a class="moz-txt-link-freetext" href="https://github.com/llvm/llvm-project/commit/83338d5032424741accb1e851408021b47b84c08.diff">https://github.com/llvm/llvm-project/commit/83338d5032424741accb1e851408021b47b84c08.diff</a>
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
<a class="moz-txt-link-abbreviated" href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a>
</pre>
</blockquote>
</body>
</html>