[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / non-power-of-2-alignment-assumptions.c
bloba03ba08265e960bb7f9159f3763d162ea19abeff
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s
4 void *__attribute__((alloc_align(1))) alloc(int align);
6 // CHECK-LABEL: @t0(
7 // CHECK-NEXT: entry:
8 // CHECK-NEXT: [[ALIGN_ADDR:%.*]] = alloca i32, align 4
9 // CHECK-NEXT: store i32 [[ALIGN:%.*]], ptr [[ALIGN_ADDR]], align 4
10 // CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[ALIGN_ADDR]], align 4
11 // CHECK-NEXT: [[CALL:%.*]] = call ptr @alloc(i32 noundef [[TMP0]])
12 // CHECK-NEXT: [[CASTED_ALIGN:%.*]] = zext i32 [[TMP0]] to i64
13 // CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[CALL]], i64 [[CASTED_ALIGN]]) ]
14 // CHECK-NEXT: ret void
16 void t0(int align) {
17 alloc(align);
19 // CHECK-LABEL: @t1(
20 // CHECK-NEXT: entry:
21 // CHECK-NEXT: [[ALIGN_ADDR:%.*]] = alloca i32, align 4
22 // CHECK-NEXT: store i32 [[ALIGN:%.*]], ptr [[ALIGN_ADDR]], align 4
23 // CHECK-NEXT: [[CALL:%.*]] = call ptr @alloc(i32 noundef 7)
24 // CHECK-NEXT: call void @llvm.assume(i1 true) [ "align"(ptr [[CALL]], i64 7) ]
25 // CHECK-NEXT: ret void
27 void t1(int align) {
28 alloc(7);
30 // CHECK-LABEL: @t2(
31 // CHECK-NEXT: entry:
32 // CHECK-NEXT: [[ALIGN_ADDR:%.*]] = alloca i32, align 4
33 // CHECK-NEXT: store i32 [[ALIGN:%.*]], ptr [[ALIGN_ADDR]], align 4
34 // CHECK-NEXT: [[CALL:%.*]] = call align 8 ptr @alloc(i32 noundef 8)
35 // CHECK-NEXT: ret void
37 void t2(int align) {
38 alloc(8);