[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / regparm-flag.c
blobd888c1e344c03b58482799e8ce6f89f0dee25cd2
1 // RUN: %clang_cc1 -triple i386-unknown-unknown -mregparm 4 %s -emit-llvm -o - | FileCheck %s
2 // RUN: %clang_cc1 -triple i386-unknown-unknown -fsanitize=array-bounds %s -emit-llvm -o - | FileCheck %s --check-prefix=RUNTIME0
3 // RUN: %clang_cc1 -triple i386-unknown-unknown -mregparm 1 -fsanitize=array-bounds %s -emit-llvm -o - | FileCheck %s --check-prefix=RUNTIME1
4 // RUN: %clang_cc1 -triple i386-unknown-unknown -mregparm 2 -fsanitize=array-bounds %s -emit-llvm -o - | FileCheck %s --check-prefix=RUNTIME2
5 // RUN: %clang_cc1 -triple i386-unknown-unknown -mregparm 3 -fsanitize=array-bounds %s -emit-llvm -o - | FileCheck %s --check-prefix=RUNTIME2
7 void f1(int a, int b, int c, int d,
8 int e, int f, int g, int h);
10 void f2(int a, int b) __attribute((regparm(0)));
12 void f0(void) {
13 // CHECK: call void @f1(i32 inreg noundef 1, i32 inreg noundef 2, i32 inreg noundef 3, i32 inreg noundef 4,
14 // CHECK: i32 noundef 5, i32 noundef 6, i32 noundef 7, i32 noundef 8)
15 f1(1, 2, 3, 4, 5, 6, 7, 8);
16 // CHECK: call void @f2(i32 noundef 1, i32 noundef 2)
17 f2(1, 2);
20 struct has_array {
21 int a;
22 int b[4];
23 int c;
26 int access(struct has_array *p, int index)
28 return p->b[index];
31 // CHECK: declare void @f1(i32 inreg noundef, i32 inreg noundef, i32 inreg noundef, i32 inreg noundef,
32 // CHECK: i32 noundef, i32 noundef, i32 noundef, i32 noundef)
33 // CHECK: declare void @f2(i32 noundef, i32 noundef)
35 // RUNTIME0: declare void @__ubsan_handle_out_of_bounds_abort(ptr, i32)
36 // RUNTIME1: declare void @__ubsan_handle_out_of_bounds_abort(ptr inreg, i32)
37 // RUNTIME2: declare void @__ubsan_handle_out_of_bounds_abort(ptr inreg, i32 inreg)