[PATCH] D117664: [Support] Remove incorrect noalias return attribute in BumpPtrAllocator
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 19 08:16:27 PST 2022
nikic updated this revision to Diff 401249.
nikic added a comment.
Add comment.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117664/new/
https://reviews.llvm.org/D117664
Files:
llvm/include/llvm/Support/Allocator.h
Index: llvm/include/llvm/Support/Allocator.h
===================================================================
--- llvm/include/llvm/Support/Allocator.h
+++ llvm/include/llvm/Support/Allocator.h
@@ -141,8 +141,10 @@
}
/// Allocate space at the specified alignment.
- LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void *
- Allocate(size_t Size, Align Alignment) {
+ // This method is *not* marked noalias, because
+ // SpecificBumpPtrAllocator::DestroyAll() loops over all allocations, and
+ // that loop is not based on the Allocate() return value.
+ LLVM_ATTRIBUTE_RETURNS_NONNULL void *Allocate(size_t Size, Align Alignment) {
// Keep track of how many bytes we've allocated.
BytesAllocated += Size;
@@ -198,7 +200,7 @@
return AlignedPtr;
}
- inline LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void *
+ inline LLVM_ATTRIBUTE_RETURNS_NONNULL void *
Allocate(size_t Size, size_t Alignment) {
assert(Alignment > 0 && "0-byte alignment is not allowed. Use 1 instead.");
return Allocate(Size, Align(Alignment));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117664.401249.patch
Type: text/x-patch
Size: 1096 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220119/6eb23d3f/attachment.bin>
More information about the llvm-commits
mailing list