Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions lib/passes/typegen/dimeta/DimetaTypeGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,25 @@ template <typename Type>
std::pair<std::optional<typeart_builtin_type>, int> typeid_if_ptr(const Type& type) {
using namespace dimeta;
const auto& quals = type.qual;
int count{0};
if (!quals.empty()) {
count = llvm::count_if(quals, [](auto& qual) { return qual == Qualifier::kPtr || qual == Qualifier::kRef; });
if (count > 0) {
return {{TYPEART_POINTER}, count};
const int count =
llvm::count_if(quals, [](auto& qual) { return qual == Qualifier::kPtr || qual == Qualifier::kRef; });

if constexpr (std::is_same_v<Type, typename dimeta::QualifiedFundamental>) {
switch (type.type.encoding) {
case FundamentalType::Encoding::kVtablePtr:
return {TYPEART_VTABLE_POINTER, count};
case FundamentalType::Encoding::kNullptr:
return {TYPEART_NULLPOINTER, count};
case FundamentalType::Encoding::kVoid:
return {TYPEART_VOID, count};
default:
break;
}
}
if (count > 0) {
return {{TYPEART_POINTER}, count};
}

return {{}, count};
}

Expand Down Expand Up @@ -220,6 +232,8 @@ std::optional<typeart_builtin_type> get_builtin_typeid(const dimeta::QualifiedFu
const auto encoding = type.type.encoding;

switch (encoding) {
case FundamentalType::Encoding::kVtablePtr:
return TYPEART_VTABLE_POINTER;
case FundamentalType::Encoding::kUnknown:
return TYPEART_UNKNOWN_TYPE;
case FundamentalType::Encoding::kVoid:
Expand Down
1 change: 1 addition & 0 deletions lib/typelib/TypeDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ inline constexpr auto size_complex_long_double = sizeof(std::complex<long double
#define FOR_EACH_TYPEART_BUILTIN(X) \
X(TYPEART_UNKNOWN_TYPE, "typeart_unknown_type", 0) \
X(TYPEART_POINTER, "ptr", sizeof(void*)) \
X(TYPEART_VTABLE_POINTER, "vtable_ptr", sizeof(void*)) \
X(TYPEART_VOID, "void*", sizeof(void*)) \
X(TYPEART_NULLPOINTER, "nullptr_t", sizeof(void*)) \
X(TYPEART_BOOL, "bool", sizeof(bool)) \
Expand Down
1 change: 1 addition & 0 deletions lib/typelib/TypeInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ typedef enum typeart_builtin_type_t { // NOLINT
TYPEART_UNKNOWN_TYPE = 0,

TYPEART_POINTER,
TYPEART_VTABLE_POINTER,
TYPEART_VOID,
TYPEART_NULLPOINTER,

Expand Down
2 changes: 1 addition & 1 deletion test/pass/arrays/01_simple_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ void test() {

// ALLOC: [[POINTER:%[0-9a-z]+]] = alloca [100 x i32]
// ALLOC-NEXT: [[POINTER2:%[0-9a-z]+]] = bitcast [100 x i32]* [[POINTER]] to i8*
// ALLOC-NEXT: call void @__typeart_alloc_stack(i8* [[POINTER2]], i32 12, i64 100)
// ALLOC-NEXT: call void @__typeart_alloc_stack(i8* [[POINTER2]], i32 13, i64 100)

// CHECK: call void @__typeart_leave_scope(i32 %__ta_counter_load)
2 changes: 1 addition & 1 deletion test/pass/arrays/02_array_to_pointer.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ void test() {

// CHECK: [[POINTER:%[0-9a-z]+]] = alloca [100 x i32]
// CHECK-NEXT: [[POINTER2:%[0-9a-z]+]] = bitcast [100 x i32]* [[POINTER]] to i8*
// CHECK-NEXT: call void @__typeart_alloc_stack(i8* [[POINTER2]], i32 12, i64 100)
// CHECK-NEXT: call void @__typeart_alloc_stack(i8* [[POINTER2]], i32 13, i64 100)

// CHECK: call void @__typeart_leave_scope(i32 %__ta_counter_load)
8 changes: 4 additions & 4 deletions test/pass/arrays/03_multidim_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void test() {
// CHECK: Free{{[ ]*}}:{{[ ]*}}0
// CHECK: Alloca{{[ ]*}}:{{[ ]*}}6

// CHECK: call void @__typeart_alloc_stack({{i8\*|ptr}} %{{[0-9a-z]+}}, i32 12, i64 64)
// CHECK: call void @__typeart_alloc_stack({{i8\*|ptr}} %{{[0-9a-z]+}}, i32 12, i64 4096)
// CHECK: call void @__typeart_alloc_stack({{i8\*|ptr}} %{{[0-9a-z]+}}, i32 12, i64 8192)
// CHECK: call void @__typeart_alloc_stack({{i8\*|ptr}} %{{[0-9a-z]+}}, i32 12, i64 524288)
// CHECK: call void @__typeart_alloc_stack({{i8\*|ptr}} %{{[0-9a-z]+}}, i32 13, i64 64)
// CHECK: call void @__typeart_alloc_stack({{i8\*|ptr}} %{{[0-9a-z]+}}, i32 13, i64 4096)
// CHECK: call void @__typeart_alloc_stack({{i8\*|ptr}} %{{[0-9a-z]+}}, i32 13, i64 8192)
// CHECK: call void @__typeart_alloc_stack({{i8\*|ptr}} %{{[0-9a-z]+}}, i32 13, i64 524288)
2 changes: 1 addition & 1 deletion test/pass/arrays/06_malloc_of_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ void foo(int n) {
int(*array)[3] = malloc(2 * sizeof(int[3]));
}

// CHECK: @__typeart_alloc({{i8\*|ptr}} %{{[0-9a-z]+}}, i32 12, i64 6)
// CHECK: @__typeart_alloc({{i8\*|ptr}} %{{[0-9a-z]+}}, i32 13, i64 6)
14 changes: 7 additions & 7 deletions test/pass/filter/01_alloca.llin
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ declare dso_local noalias i8* @malloc(i64) #1
; CHECK-FILTER-EXP: %__ta_alloca_counter = alloca i{{(64|32)}}
; CHECK-FILTER-EXP-NEXT: store i{{(64|32)}} 0, i{{(64|32)}}* %__ta_alloca_counter
; CHECK-FILTER-EXP: %0 = bitcast i32* %a to i8*
; CHECK-FILTER-EXP-NEXT: call void @__typeart_alloc_stack(i8* %0, i32 12, i64 1)
; CHECK-FILTER-EXP-NEXT: call void @__typeart_alloc_stack(i8* %0, i32 13, i64 1)
; CHECK-FILTER-EXP: %1 = bitcast i32** %c to i8*
; CHECK-FILTER-EXP-NEXT call void @__typeart_alloc_stack(i8* %1, i32 1, i64 1)
; CHECK-FILTER-EXP: %2 = bitcast i32* %d to i8*
; CHECK-FILTER-EXP-NEXT call void @__typeart_alloc_stack(i8* %2, i32 12, i64 1)
; CHECK-FILTER-EXP-NEXT call void @__typeart_alloc_stack(i8* %2, i32 13, i64 1)
; CHECK-FILTER-EXP: %3 = bitcast i32* %x to i8*
; CHECK-FILTER-EXP-NEXT call void @__typeart_alloc_stack(i8* %3, i32 12, i64 1)
; CHECK-FILTER-EXP-NEXT call void @__typeart_alloc_stack(i8* %3, i32 13, i64 1)
; CHECK-FILTER-EXP: %10 = load i{{(64|32)}}, i{{(64|32)}}* %__ta_alloca_counter
; CHECK-FILTER-EXP-NEXT: %11 = add i{{(64|32)}} 4, %10
; CHECK-FILTER-EXP: call void @__typeart_leave_scope(i{{(64|32)}} %__ta_counter_load)
Expand All @@ -83,15 +83,15 @@ declare dso_local noalias i8* @malloc(i64) #1
; CHECK: %__ta_alloca_counter = alloca i{{(64|32)}}
; CHECK-NEXT: store i{{(64|32)}} 0, i{{(64|32)}}* %__ta_alloca_counter
; CHECK: %0 = bitcast i32* %a to i8*
; CHECK-NEXT: call void @__typeart_alloc_stack(i8* %0, i32 12, i64 1)
; CHECK-NEXT: call void @__typeart_alloc_stack(i8* %0, i32 13, i64 1)
; CHECK: %1 = bitcast i32* %b to i8*
; CHECK-NEXT: call void @__typeart_alloc_stack(i8* %1, i32 12, i64 1)
; CHECK-NEXT: call void @__typeart_alloc_stack(i8* %1, i32 13, i64 1)
; CHECK: %2 = bitcast i32** %c to i8*
; CHECK-NEXT: call void @__typeart_alloc_stack(i8* %2, i32 1, i64 1)
; CHECK: %3 = bitcast i32* %d to i8*
; CHECK-NEXT: call void @__typeart_alloc_stack(i8* %3, i32 12, i64 1)
; CHECK-NEXT: call void @__typeart_alloc_stack(i8* %3, i32 13, i64 1)
; CHECK: %4 = bitcast i32* %x to i8*
; CHECK-NEXT: call void @__typeart_alloc_stack(i8* %4, i32 12, i64 1)
; CHECK-NEXT: call void @__typeart_alloc_stack(i8* %4, i32 13, i64 1)
; CHECK: %11 = load i{{(64|32)}}, i{{(64|32)}}* %__ta_alloca_counter
; CHECK-NEXT: %12 = add i{{(64|32)}} 5, %11
; CHECK: call void @__typeart_leave_scope(i{{(64|32)}} %__ta_counter_load)
Expand Down
2 changes: 1 addition & 1 deletion test/pass/filter/12_omp_correlate.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void foo() {
// check-inst: define {{.*}} @foo
// check-inst: %d = alloca
// check-inst: [[POINTER:%[0-9a-z]+]] = bitcast i32* %d to i8*
// check-inst: call void @__typeart_alloc_stack(i8* [[POINTER]], i32 12, i64 1)
// check-inst: call void @__typeart_alloc_stack(i8* [[POINTER]], i32 13, i64 1)
// check-inst-not: __typeart_alloc_stack_omp
int d = 3;
int e = 4;
Expand Down
2 changes: 1 addition & 1 deletion test/pass/filter/13_omp_loops.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void foo(int count) {
// check-inst: define {{.*}} @foo
// check-inst: %d = alloca
// check-inst: [[POINTER:%[0-9a-z]+]] = bitcast i32* %d to i8*
// check-inst: call void @__typeart_alloc_stack(i8* [[POINTER]], i32 12, i64 1)
// check-inst: call void @__typeart_alloc_stack(i8* [[POINTER]], i32 13, i64 1)
// check-inst-not: __typeart_alloc_stack_omp
int d = 3;
int e = 4;
Expand Down
2 changes: 1 addition & 1 deletion test/pass/filter/14_omp_nested.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void foo() {
// check-inst: define {{.*}} @foo
// check-inst: %x = alloca
// check-inst: %0 = bitcast i32* %x to i8*
// check-inst: call void @__typeart_alloc_stack(i8* %0, i32 12, i64 1)
// check-inst: call void @__typeart_alloc_stack(i8* %0, i32 13, i64 1)
// check-inst-not: __typeart_alloc_stack_omp
int x;
#pragma omp parallel
Expand Down
2 changes: 1 addition & 1 deletion test/pass/filter/15_omp_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void foo() {
// check-inst: define {{.*}} @foo
// check-inst: %x = alloca
// check-inst: %0 = bitcast i32* %x to i8*
// check-inst: call void @__typeart_alloc_stack(i8* %0, i32 12, i64 1)
// check-inst: call void @__typeart_alloc_stack(i8* %0, i32 13, i64 1)
// check-inst-not: __typeart_alloc_stack_omp
int x;
#pragma omp parallel
Expand Down
2 changes: 1 addition & 1 deletion test/pass/filter/16_omp_reduction.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void foo() {
// check-inst: define {{.*}} @foo
// check-inst: %loc = alloca
// check-inst: [[POINTER:%[0-9a-z]+]] = bitcast float* %loc to i8*
// check-inst: call void @__typeart_alloc_stack(i8* [[POINTER]], i32 22, i64 1)
// check-inst: call void @__typeart_alloc_stack(i8* [[POINTER]], i32 23, i64 1)
// check-inst-not: __typeart_alloc_stack_omp
float loc = sum(array, n);
MPI_send((void*)&loc);
Expand Down
2 changes: 1 addition & 1 deletion test/pass/filter/18_omp_last_priv_nested.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void func_other(int* x, int* e) {

void bar(int x_other) {
// check-inst: define {{.*}} @bar
// check-inst: call void @__typeart_alloc_stack({{i8\*|ptr}} %{{[0-9a-z]}}, i32 12, i64 1)
// check-inst: call void @__typeart_alloc_stack({{i8\*|ptr}} %{{[0-9a-z]}}, i32 13, i64 1)
int x = x_other;
int y = 2;
#pragma omp parallel
Expand Down
4 changes: 2 additions & 2 deletions test/pass/filter/19_omp_first_priv_nested.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void func(int* x, int* e) {

void foo() {
// check-inst: define {{.*}} @foo
// check-inst: call void @__typeart_alloc_stack({{i8\*|ptr}} %{{[a-z0-9]}}, i32 12, i64 1)
// check-inst: call void @__typeart_alloc_stack({{i8\*|ptr}} %{{[a-z0-9]}}, i32 13, i64 1)
int x = 1;
int y = 2;
#pragma omp parallel
Expand All @@ -45,7 +45,7 @@ void func_other(int* x, int* e) {

void bar(int x_other) {
// check-inst: define {{.*}} @bar
// check-inst: call void @__typeart_alloc_stack({{i8\*|ptr}} %{{[a-z0-9]+}}, i32 12, i64 1)
// check-inst: call void @__typeart_alloc_stack({{i8\*|ptr}} %{{[a-z0-9]+}}, i32 13, i64 1)
int x = x_other;
int y = 2;
#pragma omp parallel
Expand Down
8 changes: 4 additions & 4 deletions test/pass/filter/20_omp_priv_combi_nested.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ void func(int* x, int* e) {

void foo() {
// check-inst: define {{.*}} @foo
// check-inst: call void @__typeart_alloc_stack(i8* %0, i32 12, i64 1)
// check-inst: call void @__typeart_alloc_stack(i8* %0, i32 13, i64 1)

// check-opt-inst: define {{.*}} @foo
// check-opt-inst: call void @__typeart_alloc_stack(i8* %0, i32 12, i64 1)
// check-opt-inst: call void @__typeart_alloc_stack(i8* %0, i32 13, i64 1)
int x = 1;
int y = 2;
#pragma omp parallel
Expand Down Expand Up @@ -68,10 +68,10 @@ void func_other(int* x, int* e) {

void bar(int x_other) {
// check-inst: define {{.*}} @bar
// check-inst: call void @__typeart_alloc_stack(i8* %{{[0-9]}}, i32 12, i64 1)
// check-inst: call void @__typeart_alloc_stack(i8* %{{[0-9]}}, i32 13, i64 1)

// check-opt-inst: define {{.*}} @bar
// check-opt-inst: call void @__typeart_alloc_stack(i8* %{{[0-9]}}, i32 12, i64 1)
// check-opt-inst: call void @__typeart_alloc_stack(i8* %{{[0-9]}}, i32 13, i64 1)
int x = x_other;
int y = 2;
#pragma omp parallel
Expand Down
2 changes: 1 addition & 1 deletion test/pass/filter/22_omp_ident_offset.llin
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ entry:
; TEST: the translation to fork_call(%s, %outlined, ...) -> outlined should handle the internal struct.ident_t %s arg when following dataflow
; CHECK: @foo()
; CHECK: [[POINTER:%[0-9a-z]+]] = bitcast i32* %x to i8*
; CHECK: call void @__typeart_alloc_stack(i8* [[POINTER]], i32 12, i64 1)
; CHECK: call void @__typeart_alloc_stack(i8* [[POINTER]], i32 13, i64 1)
%x = alloca i32, align 4
%0 = bitcast i32* %x to i8*
%s = alloca %struct.ident_t, align 8
Expand Down
2 changes: 1 addition & 1 deletion test/pass/malloc_free/01_simple_malloc_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ void test() {
// CHECK-NEXT: Alloca{{[ ]*}}:{{[ ]*}}0

// CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @malloc
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 12, i64 42)
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 13, i64 42)
2 changes: 1 addition & 1 deletion test/pass/malloc_free/02_simple_malloc_free_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void test() {
// CHECK-NEXT: Alloca{{[ ]*}}:{{[ ]*}}0

// CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @malloc
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 12
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 13

// CHECK: call void @free({{i8\*|ptr}}{{( noundef)?}} [[POINTER:%[0-9a-z]+]])
// CHECK-NEXT: call void @__typeart_free({{i8\*|ptr}} [[POINTER]])
2 changes: 1 addition & 1 deletion test/pass/malloc_free/03_simple_malloc_free_double.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void test() {
// CHECK-NEXT: Alloca{{[ ]*}}:{{[ ]*}}0

// CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @malloc
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 23, i64 42)
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 24, i64 42)

// CHECK: call void @free({{i8\*|ptr}}{{( noundef)?}} [[POINTER:%[0-9a-z]+]])
// CHECK-NEXT: call void @__typeart_free({{i8\*|ptr}} [[POINTER]])
2 changes: 1 addition & 1 deletion test/pass/malloc_free/04_simple_malloc_int_double.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ void test() {
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]],

// CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @malloc
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 23
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 24
2 changes: 1 addition & 1 deletion test/pass/malloc_free/06_simple_malloc_void_type.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ void test() {
}

// CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @malloc
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 {{(10|2)}}, i64 168)
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 {{(11|3)}}, i64 168)

// PASS-OUT: TypeArtPass [Heap]
// PASS-OUT-NEXT: Malloc{{[ ]*}}:{{[ ]*}}1
Expand Down
2 changes: 1 addition & 1 deletion test/pass/malloc_free/08_simple_malloc_struct_void.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void test() {
}

// CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @malloc
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 {{2|10}}, i64 16)
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 {{3|11}}, i64 16)

// CHECK: call void @free({{i8\*|ptr}}{{( noundef)?}} [[POINTER:%[0-9a-z]+]])
// CHECK-NEXT: call void @__typeart_free({{i8\*|ptr}} [[POINTER]])
Expand Down
2 changes: 1 addition & 1 deletion test/pass/malloc_free/09_malloc_with_disjunct_free.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void foo(double* ptr) {
// CHECK-NEXT: Alloca{{[ ]*}}:{{[ ]*}}0

// CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @malloc
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 23
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 24

// CHECK: call void @free({{i8\*|ptr}}{{( noundef)?}} [[POINTER:%[0-9a-z]+]])
// CHECK-NEXT: call void @__typeart_free({{i8\*|ptr}} [[POINTER]])
4 changes: 2 additions & 2 deletions test/pass/malloc_free/11_calloc_realloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ int main() {
// CHECK-NEXT: Alloca{{[ ]*}}:{{[ ]*}}0

// CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @calloc(i64{{( noundef)?}} [[SIZE:[0-9]+]], i64{{( noundef)?}} 8)
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 23, i64 [[SIZE]])
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 24, i64 [[SIZE]])

// REALLOC: __typeart_free({{i8\*|ptr}} [[POINTER:%[0-9a-z]+]])
// REALLOC-NEXT: [[POINTER2:%[0-9a-z]+]] = call{{( align [0-9]+)?}} {{i8\*|ptr}} @realloc({{i8\*|ptr}}{{( noundef)?}} [[POINTER]], i64{{( noundef)?}} 160)
// REALLOC-NEXT: __typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 23, i64 20)
// REALLOC-NEXT: __typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 24, i64 20)

// clang-format on
2 changes: 1 addition & 1 deletion test/pass/malloc_free/12_malloc_memcpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ typedef struct {
// clang-format off
// CHECK-OPT: tail call void @free
// CHECK-OPT-NEXT: call void @__typeart_free
// CHECK-OPT: call void @__typeart_alloc({{i8\*|ptr}} %{{[0-9a-z]+}}, i32 {{(10|12)}},
// CHECK-OPT: call void @__typeart_alloc({{i8\*|ptr}} %{{[0-9a-z]+}}, i32 {{(11|13)}},
// CHECK-OPT: call void @llvm.memcpy.p0{{(i8)?}}.p0{{(i8)?}}.i64({{i8\*|ptr}} {{(align[[:space:]]?(4|16)[[:space:]])?}}%{{[0-9a-z]+}},
// clang-format on
void setVartypes(struct_grid* pgrid, int nvars, int* vartypes /* = i32 ptr */) {
Expand Down
4 changes: 2 additions & 2 deletions test/pass/malloc_free/13_calloc_void_type.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ void foo(int n) {
// clang-format off

// CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @calloc(i64{{( noundef)?}} [[SIZE:[0-9a-z]+]], i64{{( noundef)?}} 8)
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 {{(10|2)}}, i64 80)
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 {{(11|3)}}, i64 80)

// CHECK: [[POINTER2:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @calloc(i64{{( noundef)?}} [[SIZE2:%[0-9a-z]+]], i64{{( noundef)?}} 8)
// CHECK-NOT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 {{(10|2)}}, i64 [[SIZE2]])
// CHECK-NOT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 {{(11|3)}}, i64 [[SIZE2]])

// clang-format on
6 changes: 3 additions & 3 deletions test/pass/malloc_free/14_aligned_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ void foo(int n) {

// clang-format off
// CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @aligned_alloc(i64{{( noundef)?}} 64, i64{{( noundef)?}} 20)
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 12, i64 5)
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 13, i64 5)

// CHECK: [[POINTER2:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @aligned_alloc(i64{{( noundef)?}} 128, i64{{( noundef)?}} [[SIZE:%[0-9a-z]+]])
// CHECK-NOT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 12, i64 [[SIZE]])
// CHECK: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 12, i64 %{{[0-9a-z]+}})
// CHECK-NOT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 13, i64 [[SIZE]])
// CHECK: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 13, i64 %{{[0-9a-z]+}})
// clang-format on
4 changes: 2 additions & 2 deletions test/pass/malloc_free/15_aligned_alloc_void_type.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ void foo(int n) {

// clang-format off
// CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @aligned_alloc(i64{{( noundef)?}} 64, i64{{( noundef)?}} 20)
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 {{(10|2)}}, i64 20)
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER]], i32 {{(11|3)}}, i64 20)

// CHECK: [[POINTER2:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} {{i8\*|ptr}} @aligned_alloc(i64{{( noundef)?}} 128, i64{{( noundef)?}} [[SIZE:%[0-9a-z]+]])
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 {{(10|2)}}, i64 [[SIZE]])
// CHECK-NEXT: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 {{(11|3)}}, i64 [[SIZE]])
// clang-format on
6 changes: 3 additions & 3 deletions test/pass/malloc_free/16_omp_heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ void foo(int** x) {
// CHECK-NEXT: Alloca{{[ ]*}}:{{[ ]*}}0

// CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} i8* @calloc(i64{{( noundef)?}} [[SIZE:[0-9a-z]+]], i64{{( noundef)?}} 8)
// CHECK-NEXT: call void @__typeart_alloc_omp(i8* [[POINTER]], i32 23, i64 [[SIZE]])
// CHECK-NEXT: call void @__typeart_alloc_omp(i8* [[POINTER]], i32 24, i64 [[SIZE]])
// CHECK-NEXT: bitcast i8* [[POINTER]] to double*

// CHECK: __typeart_free_omp(i8* [[POINTER:%[0-9a-z]+]])
// CHECK-NEXT: [[POINTER2:%[0-9a-z]+]] = call{{( align [0-9]+)?}} i8* @realloc(i8*{{( noundef)?}} [[POINTER]], i64{{( noundef)?}} 160)
// CHECK-NEXT: __typeart_alloc_omp(i8* [[POINTER2]], i32 23, i64 20)
// CHECK-NEXT: __typeart_alloc_omp(i8* [[POINTER2]], i32 24, i64 20)

// CHECK: [[POINTER:%[0-9a-z]+]] = call noalias{{( align [0-9]+)?}} i8* @malloc
// CHECK-NEXT: call void @__typeart_alloc_omp(i8* [[POINTER]], i32 12, i64 8)
// CHECK-NEXT: call void @__typeart_alloc_omp(i8* [[POINTER]], i32 13, i64 8)
// CHECK-NEXT: bitcast i8* [[POINTER]] to i32*

// CHECK: call void @free
Expand Down
2 changes: 1 addition & 1 deletion test/pass/malloc_free/17_realloc_void.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ void foo() {

// REALLOC: __typeart_free({{i8\*|ptr}} [[POINTER:%[0-9a-z]+]])
// REALLOC-NEXT: [[POINTER2:%[0-9a-z]+]] = call{{( align [0-9]+)?}} {{i8\*|ptr}} @realloc({{i8\*|ptr}}{{( noundef)?}} [[POINTER]], i64{{( noundef)?}} 160)
// REALLOC-NEXT: __typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 {{2|10}}, i64 160)
// REALLOC-NEXT: __typeart_alloc({{i8\*|ptr}} [[POINTER2]], i32 {{3|11}}, i64 160)

// clang-format on
2 changes: 1 addition & 1 deletion test/pass/new_delete/01_inv_simple_new_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <new>
// CHECK: invoke{{.*}} {{i8\*|ptr}} @_Znwm(i64{{( noundef)?}} 4)
// CHECK: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER:%[0-9a-z]+]], i32 12, i64 1)
// CHECK: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER:%[0-9a-z]+]], i32 13, i64 1)
int main() {
try {
auto s = new int;
Expand Down
2 changes: 1 addition & 1 deletion test/pass/new_delete/02_inv_simple_int_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <new>
// CHECK: invoke{{.*}} {{i8\*|ptr}} @_Znam(i64{{( noundef)?}} 8)
// CHECK: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER:%[0-9a-z]+]], i32 12, i64 2)
// CHECK: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER:%[0-9a-z]+]], i32 13, i64 2)
int main() {
try {
auto s = new int[2];
Expand Down
Loading