/llvm-project/compiler-rt/lib/gwp_asan/tests/ |
H A D | alignment.cpp | 1 //===-- alignment.cpp -------------------------------------------*- C++ -*-===// 14 static size_t getRequiredBackingSize(size_t Size, size_t Alignment, in getRequiredBackingSize() argument 16 return GuardedPoolAllocator::getRequiredBackingSize(Size, Alignment, in getRequiredBackingSize() 19 static uintptr_t alignUp(uintptr_t Ptr, size_t Alignment) { in alignUp() argument 20 return GuardedPoolAllocator::alignUp(Ptr, Alignment); in alignUp() 22 static uintptr_t alignDown(uintptr_t Ptr, size_t Alignment) { in alignDown() argument 23 return GuardedPoolAllocator::alignDown(Ptr, Alignment); in alignDown() 32 // alignment functionality. 36 // Alignment < Page Size. in TEST() 38 /* Ptr */ 0x4000, /* Alignment */ 0x1)); in TEST() [all …]
|
/llvm-project/llvm/test/CodeGen/SystemZ/ |
H A D | frame-26.mir | 37 alignment: 16 46 - { id: 0, size: 96, alignment: 8 } 47 - { id: 1, size: 1960, alignment: 8 } 48 - { id: 2, size: 8, alignment: 8 } 49 - { id: 3, size: 320, alignment: 8 } 50 - { id: 4, size: 4, alignment: 4 } 51 - { id: 5, size: 8, alignment: 8 } 52 - { id: 6, size: 8, alignment: 8 } 53 - { id: 7, size: 4, alignment: 4 } 54 - { id: 8, size: 8, alignment: 8 } [all …]
|
/llvm-project/llvm/lib/CodeGen/ |
H A D | MachineFrameInfo.cpp | 31 void MachineFrameInfo::ensureMaxAlignment(Align Alignment) { in ensureMaxAlignment() argument 33 assert(Alignment <= StackAlignment && in ensureMaxAlignment() 34 "For targets without stack realignment, Alignment is out of limit!"); in ensureMaxAlignment() 35 if (MaxAlignment < Alignment) in ensureMaxAlignment() 36 MaxAlignment = Alignment; in ensureMaxAlignment() 39 /// Clamp the alignment if requested and emit a warning. 40 static inline Align clampStackAlignment(bool ShouldClamp, Align Alignment, in clampStackAlignment() argument 42 if (!ShouldClamp || Alignment <= StackAlignment) in clampStackAlignment() 43 return Alignment; in clampStackAlignment() 44 LLVM_DEBUG(dbgs() << "Warning: requested alignment " << DebugSt in clampStackAlignment() 51 CreateStackObject(uint64_t Size,Align Alignment,bool IsSpillSlot,const AllocaInst * Alloca,uint8_t StackID) CreateStackObject() argument 66 CreateSpillStackObject(uint64_t Size,Align Alignment) CreateSpillStackObject() argument 74 CreateVariableSizedObject(Align Alignment,const AllocaInst * Alloca) CreateVariableSizedObject() argument 92 Align Alignment = CreateFixedObject() local 105 Align Alignment = CreateFixedSpillStackObject() local 159 Align Alignment = getObjectAlign(i); estimateStackSize() local [all...] |
/llvm-project/libc/src/__support/ |
H A D | block.h | 27 /// Returns the value rounded down to the nearest multiple of alignment. 28 LIBC_INLINE constexpr size_t align_down(size_t value, size_t alignment) { 30 return (value / alignment) * alignment; 33 /// Returns the value rounded up to the nearest multiple of alignment. May wrap 35 LIBC_INLINE constexpr size_t align_up(size_t value, size_t alignment) { 36 return align_down(value + alignment - 1, alignment); 243 LIBC_INLINE bool is_usable_space_aligned(size_t alignment) const { in mark_used() 244 return reinterpret_cast<uintptr_t>(usable_space()) % alignment in mark_used() 37 align_down(size_t value,size_t alignment) align_down() argument 44 align_down(T * value,size_t alignment) align_down() argument 50 align_up(size_t value,size_t alignment) align_up() argument 57 align_up(T * value,size_t alignment) align_up() argument 227 size_t alignment() const { return used() ? info_.alignment : 1; } alignment() function 265 is_usable_space_aligned(size_t alignment) is_usable_space_aligned() argument 269 padding_for_alignment(size_t alignment) padding_for_alignment() argument 359 uint16_t alignment : 14; global() member 369 get_aligned_subspan(ByteSpan bytes,size_t alignment) get_aligned_subspan() argument 419 can_allocate(size_t alignment,size_t size) can_allocate() argument 434 allocate(Block * block,size_t alignment,size_t size) allocate() argument [all...] |
/llvm-project/clang/test/CXX/dcl.dcl/dcl.attr/dcl.align/ |
H A D | p5.cpp | 3 alignas(1) int n1; // expected-error {{requested alignment is less than minimum alignment of 4 for … 4 alignas(1) alignas(2) int n2; // expected-error {{less than minimum alignment}} 6 alignas(1) alignas(2) alignas(0) int n4; // expected-error {{less than minimum alignment}} 9 alignas(1) int n7 alignas(2), // expected-error {{less than minimum alignment}} 12 alignas(1) extern int n10; // expected-error {{less than minimum alignment}} 21 struct alignas(2) S2 { // expected-error {{requested alignment is less than minimum alignment of 4 … 24 struct alignas(2) S3 { // expected-error {{requested alignment is less than minimum alignment of 8 … 27 struct alignas(2) S4 : S1 { // expected-error {{requested alignment is less than minimum alignment … 30 …alignas(2) S1 s1; // expected-error {{requested alignment is less than minimum alignment of 8 for … 40 S1 s1 alignas(4); // expected-error {{requested alignment is less than minimum alignment of 8 for t… [all …]
|
/llvm-project/mlir/lib/Dialect/SPIRV/Utils/ |
H A D | LayoutUtils.cpp | 9 // This file implements Utilities used to get alignment and layout information 23 Size alignment = 1; in decorateType() local 24 return decorateType(structType, size, alignment); in decorateType() 30 VulkanLayoutUtils::Size &alignment) { in decorateType() argument 58 // "A structure has a base alignment equal to the largest base alignment of in decorateType() 66 // structure or an array and the next multiple of the alignment of that in decorateType() 69 alignment = maxMemberAlignment; in decorateType() 81 VulkanLayoutUtils::Size &alignment) { in decorateType() argument 83 alignment = getScalarTypeAlignment(type); in decorateType() 85 size = alignment; in decorateType() [all …]
|
/llvm-project/mlir/include/mlir/Conversion/MemRefToLLVM/ |
H A D | AllocLikeConversion.h | 31 /// aligned = bumped - bumped % alignment 33 Value input, Value alignment); 39 /// Computes the alignment for the given memory allocation op. 44 Value alignment; in getAlignment() local 47 alignment = in getAlignment() 50 // In the case where no alignment is specified, we may want to override in getAlignment() 53 // alignment of the LLVM type given by the LLVM DataLayout. in getAlignment() 54 alignment = getSizeInBytes(loc, memRefType.getElementType(), rewriter); in getAlignment() 56 return alignment; in getAlignment() 59 /// Computes the alignment for aligned_alloc used to allocate the buffer for [all …]
|
/llvm-project/compiler-rt/test/scudo/ |
H A D | memalign.c | 10 // tests for the condition where the alignment is not a power of 2. 21 void *aligned_alloc(size_t alignment, size_t size); 25 size_t alignment = 1U << 12; in main() local 32 posix_memalign(&p, alignment, size); in main() 34 assert(((uintptr_t)p & (alignment - 1)) == 0); in main() 36 p = aligned_alloc(alignment, size); in main() 38 assert(((uintptr_t)p & (alignment - 1)) == 0); in main() 40 // Tests various combinations of alignment and sizes in main() 42 alignment = 1U << i; in main() 46 p = memalign(alignment, size - (2 * sizeof(void *) * k)); in main() [all …]
|
/llvm-project/llvm/test/MC/ARM/ |
H A D | neon-vld-vst-align.s | 13 @ CHECK-ERRORS: alignment must be 64 or omitted 16 @ CHECK-ERRORS: alignment must be 64 or omitted 20 @ CHECK-ERRORS: alignment must be 64 or omitted 23 @ CHECK-ERRORS: alignment must be 64 or omitted 35 @ CHECK-ERRORS: alignment must be 64 or omitted 38 @ CHECK-ERRORS: alignment must be 64 or omitted 42 @ CHECK-ERRORS: alignment must be 64 or omitted 45 @ CHECK-ERRORS: alignment must be 64 or omitted 57 @ CHECK-ERRORS: alignment must be 64 or omitted 60 @ CHECK-ERRORS: alignment must be 64 or omitted [all …]
|
/llvm-project/mlir/lib/Target/LLVMIR/ |
H A D | DataLayoutImporter.cpp | 82 FailureOr<SmallVector<uint64_t>> alignment = tryToParseIntList(token); in tryToParseAlignment() local 83 if (failed(alignment)) in tryToParseAlignment() 85 if (alignment->empty() || alignment->size() > 2) in tryToParseAlignment() 88 // Alignment specifications (such as 32 or 32:64) are of the in tryToParseAlignment() 89 // form <abi>[:<pref>], where abi specifies the minimal alignment and pref the in tryToParseAlignment() 90 // optional preferred alignment. The preferred alignment is set to the minimal in tryToParseAlignment() 91 // alignment if not available. in tryToParseAlignment() 92 uint64_t minimal = (*alignment)[ in tryToParseAlignment() 101 FailureOr<SmallVector<uint64_t>> alignment = tryToParseIntList(token); tryToParsePointerAlignment() local 196 FailureOr<uint64_t> alignment = tryToParseInt(token); tryToEmplaceStackAlignmentEntry() local [all...] |
/llvm-project/clang/test/SemaCXX/ |
H A D | amdgpu-sizeof-alignof.cpp | 14 static_assert(alignof(size_t) == 8, "bad alignment"); in test() 16 static_assert(alignof(intptr_t) == 8, "bad alignment"); in test() 18 static_assert(alignof(uintptr_t) == 8, "bad alignment"); in test() 20 static_assert(alignof(ptrdiff_t) == 8, "bad alignment"); in test() 23 static_assert(alignof(char) == 1, "bad alignment"); in test() 25 static_assert(alignof(short) == 2, "bad alignment"); in test() 27 static_assert(alignof(int) == 4, "bad alignment"); in test() 29 static_assert(alignof(long) == 8, "bad alignment"); in test() 31 static_assert(alignof(long long) == 8, "bad alignment"); in test() 33 static_assert(alignof(float) == 4, "bad alignment"); in test() [all …]
|
H A D | builtin-align-cxx.cpp | 1 // C++-specific checks for the alignment builtins 17 template <typename T, long Alignment, long ArraySize = 16> 20 …rt(__is_same(decltype(__builtin_align_up(array, Alignment)), T *), // expected-error{{requested al… in test_templated_arguments() 22 static_assert(__is_same(decltype(__builtin_align_down(array, Alignment)), T *), in test_templated_arguments() 24 static_assert(__is_same(decltype(__builtin_is_aligned(array, Alignment)), bool), in test_templated_arguments() 26 T *x1 = __builtin_align_up(array, Alignment); in test_templated_arguments() 27 T *x2 = __builtin_align_down(array, Alignment); in test_templated_arguments() 28 bool x3 = __builtin_align_up(array, Alignment); in test_templated_arguments() 36 test_templated_arguments<int, 7>(); // invalid alignment value in test() 43 …pe(__builtin_align_up(array, 31)), int *), // expected-error{{requested alignment is not a power o… in test_incorrect_alignment_without_instatiation() [all …]
|
/llvm-project/mlir/test/Dialect/LLVMIR/ |
H A D | mem2reg.mlir | 7 %1 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr 8 %2 = llvm.load %1 {alignment = 4 : i64} : !llvm.ptr -> i32 21 %3 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr 23 llvm.store %1, %3 {alignment = 4 : i64} : i32, !llvm.ptr 25 llvm.store %3, %2 {alignment = 8 : i64} : !llvm.ptr, !llvm.ptr 36 %2 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr 42 llvm.store %1, %2 {alignment = 4 : i64} : i32, !llvm.ptr 54 %3 = llvm.alloca %0 x i32 {alignment = 4 : i64} : (i32) -> !llvm.ptr 55 llvm.store %1, %3 {alignment = 4 : i64} : i32, !llvm.ptr 62 llvm.store %2, %3 {alignment [all...] |
H A D | layout.mlir | 6 // CHECK: alignment = 8 17 // CHECK: alignment = 8 28 // CHECK: alignment = 8 57 // CHECK: alignment = 4 68 // CHECK: alignment = 4 79 // CHECK: alignment = 8 90 // CHECK: alignment = 8 118 // expected-error@below {{preferred alignment is expected to be at least as large as ABI alignment}} 141 // CHECK: alignment = 4 149 // CHECK: alignment = 8 [all …]
|
/llvm-project/clang/test/Analysis/inlining/ |
H A D | placement-new-fp-suppression.cpp | 22 inline uintptr_t alignAddr(const void *Addr, size_t Alignment) { in alignAddr() argument 23 return (((uintptr_t)Addr + Alignment - 1) & ~(uintptr_t)(Alignment - 1)); in alignAddr() 26 inline size_t alignmentAdjustment(const void *Ptr, size_t Alignment) { in alignmentAdjustment() argument 27 return alignAddr(Ptr, Alignment) - (uintptr_t)Ptr; in alignmentAdjustment() 44 void *Allocate(size_t Size, size_t /*Alignment*/) { in Allocate() 51 void *Allocate(size_t Size, size_t Alignment) { in Allocate() argument 53 size_t Adjustment = alignmentAdjustment(CurPtr, Alignment); in Allocate() 56 size_t PaddedSize = SizeToAllocate + Alignment - 1; in Allocate() 58 Alignment); in Allocate() 74 void *operator new(size_t Bytes, const ASTContext &C, size_t Alignment = 8); [all …]
|
/llvm-project/llvm/test/CodeGen/PowerPC/ |
H A D | mi-peepholes-trap-opt.mir | 7 alignment: 16 31 alignment: 16 50 alignment: 16 66 alignment: 16 82 alignment: 16 97 alignment: 16 113 alignment: 16 128 alignment: 16 143 alignment: 16 160 alignment: 16 [all …]
|
/llvm-project/clang/test/CodeGen/ |
H A D | aarch64-ABI-align-packed-assembly.c |
|
/llvm-project/llvm/test/CodeGen/AArch64/ |
H A D | align-down.ll | 5 ; ptr - (ptr & (alignment-1)) 7 ; ptr & (0 - alignment) 17 define i32 @t0_32(i32 %ptr, i32 %alignment) nounwind { 23 %mask = add i32 %alignment, -1 28 define i64 @t1_64(i64 %ptr, i64 %alignment) nounwind { 34 %mask = add i64 %alignment, -1 40 define i32 @t2_commutative(i32 %ptr, i32 %alignment) nounwind { 46 %mask = add i32 %alignment, -1 54 define i32 @t3_extrause0(i32 %ptr, i32 %alignment, ptr %mask_storage) nounwind { 62 %mask = add i32 %alignment, -1 [all …]
|
/llvm-project/mlir/test/Interfaces/DataLayoutInterfaces/ |
H A D | query.mlir | 5 // CHECK: alignment = 4 11 // CHECK: alignment = 8 17 // CHECK: alignment = 4 23 // CHECK: alignment = 1 29 // CHECK: alignment = 4 35 // CHECK: alignment = 16 41 // CHECK: alignment = 16 53 // CHECK: alignment = 1 65 // CHECK: alignment = 1 79 // CHECK: alignment = 20 [all …]
|
/llvm-project/compiler-rt/lib/sanitizer_common/ |
H A D | sanitizer_allocator_report.cpp | 76 void NORETURN ReportInvalidAllocationAlignment(uptr alignment, in ReportInvalidAllocationAlignment() argument 79 ScopedAllocatorErrorReport report("invalid-allocation-alignment", stack); in ReportInvalidAllocationAlignment() 80 Report("ERROR: %s: invalid allocation alignment: %zd, alignment must be a " in ReportInvalidAllocationAlignment() 81 "power of two\n", SanitizerToolName, alignment); in ReportInvalidAllocationAlignment() 86 void NORETURN ReportInvalidAlignedAllocAlignment(uptr size, uptr alignment, in ReportInvalidAlignedAllocAlignment() argument 89 ScopedAllocatorErrorReport report("invalid-aligned-alloc-alignment", stack); in ReportInvalidAlignedAllocAlignment() 91 Report("ERROR: %s: invalid alignment requested in " in ReportInvalidAlignedAllocAlignment() 92 "aligned_alloc: %zd, alignment must be a power of two and the " in ReportInvalidAlignedAllocAlignment() 93 "requested size 0x%zx must be a multiple of alignment\n", in ReportInvalidAlignedAllocAlignment() 94 SanitizerToolName, alignment, size); in ReportInvalidAlignedAllocAlignment() [all …]
|
/llvm-project/openmp/runtime/test/api/ |
H A D | kmp_aligned_malloc.c | 10 uint64_t alignment = 1; in aligned_by() local 11 while((addr & (alignment-1)) == 0) { in aligned_by() 12 alignment <<= 1; in aligned_by() 14 return (alignment >> 1); in aligned_by() 28 int alignment = alignments[i]; in test_kmp_aligned_malloc() local 29 // allocate 64 bytes with 64-byte alignment in test_kmp_aligned_malloc() 30 // allocate 128 bytes with 128-byte alignment, etc. in test_kmp_aligned_malloc() 31 ptr = (int*)kmp_aligned_malloc(alignment, alignment); in test_kmp_aligned_malloc() 33 if(addr & (alignment-1)) { in test_kmp_aligned_malloc() 35 " alignment = %d\n", tid, ptr, aligned_by(addr), alignment); in test_kmp_aligned_malloc() [all …]
|
/llvm-project/libcxx/test/libcxx/language.support/support.dynamic/ |
H A D | new_faligned_allocation.pass.cpp |
|
/llvm-project/clang/test/AST/Interp/ |
H A D | builtin-align-cxx.cpp |
|
/llvm-project/llvm/lib/Transforms/Utils/ |
H A D | ASanStackFrameLayout.cpp | 21 // We sort the stack variables by alignment (largest first) to minimize 22 // unnecessary large gaps due to alignment. 30 return a.Alignment > b.Alignment; in CompareVars() 33 // We also force minimal alignment for all vars to kMinAlignment so that vars 34 // with e.g. alignment 1 and alignment 16 do not get reordered by CompareVars. 39 // The resulting frame size is a multiple of Alignment. 41 uint64_t Alignment) { in VarAndRedzoneSize() argument 49 return alignTo(std::max(Res, 2 * Granularity), Alignment); in VarAndRedzoneSize() 62 Vars[i].Alignment = std::max(Vars[i].Alignment, kMinAlignment); in ComputeASanStackFrameLayout() 68 Layout.FrameAlignment = std::max(Granularity, Vars[0].Alignment); in ComputeASanStackFrameLayout() [all …]
|
/llvm-project/mlir/include/mlir/Dialect/SPIRV/Utils/ |
H A D | LayoutUtils.h | 9 // This file defines utilities used to get alignment and layout information for 30 /// "There are different alignment requirements depending on the specific 33 /// There are 3 types of alignment: scalar, base, extended. 36 /// Note: Even if scalar alignment is supported, it is generally more 37 /// performant to use the base alignment. So here the calculation is based on 38 /// base alignment. 41 /// 1. The Offset decoration of any member must be a multiple of its alignment. 43 /// alignment of the array or matrix as defined above. 64 /// to the `size`. Assigns the type alignment in bytes to the `alignment`. 65 static Type decorateType(Type type, Size &size, Size &alignment); [all …]
|