[libc-commits] [PATCH] D157247: [test][libc] Fix aligned_alloc argument
Vitaly Buka via Phabricator via libc-commits
libc-commits at lists.llvm.org
Sun Aug 6 18:26:19 PDT 2023
vitalybuka updated this revision to Diff 547622.
vitalybuka added a comment.
use alignTo
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157247/new/
https://reviews.llvm.org/D157247
Files:
libc/benchmarks/LibcMemoryBenchmark.h
Index: libc/benchmarks/LibcMemoryBenchmark.h
===================================================================
--- libc/benchmarks/LibcMemoryBenchmark.h
+++ libc/benchmarks/LibcMemoryBenchmark.h
@@ -17,6 +17,7 @@
#include "MemorySizeDistributions.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Alignment.h"
+#include "llvm/Support/MathExtras.h"
#include <cstdint>
#include <optional>
#include <random>
@@ -107,11 +108,11 @@
size_t Size = 0;
public:
- // Note: msan / asan can't handle Alignment > 512.
static constexpr size_t Alignment = 512;
explicit AlignedBuffer(size_t Size)
- : Buffer(static_cast<char *>(aligned_alloc(Alignment, Size))),
+ : Buffer(static_cast<char *>(
+ aligned_alloc(Alignment, alignTo(Size, Alignment)))),
Size(Size) {}
~AlignedBuffer() { free(Buffer); }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157247.547622.patch
Type: text/x-patch
Size: 852 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230807/70333c4e/attachment.bin>
More information about the libc-commits
mailing list