// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-linux-gnu -emit-llvm < %s | FileCheck %s
// Note: this test originally asserted that malloc/calloc/realloc got alignment
// attributes on their return pointer. However, that was reverted in
// https://reviews.llvm.org/D118804 and it now asserts that they do _NOT_ get
// align attributes.
typedef __SIZE_TYPE__ size_t;
void *;
void *;
void *;
void *;
void *;
void *
void *
void *
void *
void *
void *
void *
void *
// CHECK-LABEL: @malloc_test
// CHECK: call i8* @malloc
// CHECK: declare i8* @malloc
// CHECK-LABEL: @calloc_test
// CHECK: call i8* @calloc
// CHECK: declare i8* @calloc
// CHECK-LABEL: @realloc_test
// CHECK: call i8* @realloc
// CHECK: declare i8* @realloc
// CHECK-LABEL: @aligned_alloc_variable_test
// CHECK: %[[ALLOCATED:.*]] = call i8* @aligned_alloc({{i32|i64}} noundef %[[ALIGN:.*]], {{i32|i64}} noundef %[[NBYTES:.*]])
// CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(i8* %[[ALLOCATED]], {{i32|i64}} %[[ALIGN]]) ]
// CHECK: declare i8* @aligned_alloc
// CHECK-LABEL: @memalign_variable_test
// CHECK: %[[ALLOCATED:.*]] = call i8* @memalign({{i32|i64}} noundef %[[ALIGN:.*]], {{i32|i64}} noundef %[[NBYTES:.*]])
// CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(i8* %[[ALLOCATED]], {{i32|i64}} %[[ALIGN]]) ]
// CHECK-LABEL: @aligned_alloc_constant_test
// CHECK: call align 8 i8* @aligned_alloc
// CHECK-LABEL: @aligned_alloc_large_constant_test
// CHECK: call align 4096 i8* @aligned_alloc
// CHECK-LABEL: @memalign_large_constant_test
// CHECK: align 4096 i8* @memalign