diff --git a/.github/workflows/basic-ci.yml b/.github/workflows/basic-ci.yml index db59ad0e..f8a39fda 100644 --- a/.github/workflows/basic-ci.yml +++ b/.github/workflows/basic-ci.yml @@ -43,7 +43,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-22.04, ubuntu-24.04 ] - llvm-version: [ 14, 18 ] + llvm-version: [ 14, 18, 19 ] typeart-typegen-legacy: [ 0, 1 ] preset: - name: ci-thread-safe-safeptr @@ -65,12 +65,22 @@ jobs: os: ubuntu-22.04 - llvm-version: 18 typeart-typegen-legacy: 1 + - llvm-version: 19 + os: ubuntu-22.04 + - llvm-version: 19 + typeart-typegen-legacy: 1 runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 + - name: LLVM apt + if: ${{ matrix.llvm-version == 19 }} + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main" | sudo tee /etc/apt/sources.list.d/llvm-19.list + - name: Update apt run: sudo apt-get update diff --git a/.github/workflows/ext-ci.yml b/.github/workflows/ext-ci.yml index 876055ba..9d16f848 100644 --- a/.github/workflows/ext-ci.yml +++ b/.github/workflows/ext-ci.yml @@ -15,7 +15,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-22.04, ubuntu-24.04 ] - llvm-version: [ 14, 18 ] + llvm-version: [ 14, 18, 19 ] preset: - name: release-counter - name: release-safeptr-counter @@ -25,6 +25,8 @@ jobs: os: ubuntu-24.04 - llvm-version: 18 os: ubuntu-22.04 + - llvm-version: 19 + os: ubuntu-22.04 runs-on: ${{ matrix.os }} @@ -38,6 +40,12 @@ jobs: ssh-key: ${{ secrets.AUTH_SSH_CI_EXT }} path: test-bench + - name: LLVM apt + if: ${{ matrix.llvm-version == 19 }} + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main" | sudo tee /etc/apt/sources.list.d/llvm-19.list + - name: Update apt run: sudo apt-get update @@ -106,7 +114,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-22.04, ubuntu-24.04 ] - llvm-version: [ 14, 18 ] + llvm-version: [ 14, 18, 19 ] preset: - name: release-counter - name: release-unsafe-counter @@ -115,6 +123,8 @@ jobs: os: ubuntu-24.04 - llvm-version: 18 os: ubuntu-22.04 + - llvm-version: 19 + os: ubuntu-22.04 runs-on: ${{ matrix.os }} @@ -129,6 +139,12 @@ jobs: ref: feat/ci path: ad-test-bench + - name: LLVM apt + if: ${{ matrix.llvm-version == 19 }} + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main" | sudo tee /etc/apt/sources.list.d/llvm-19.list + - name: Update apt run: sudo apt-get update @@ -184,7 +200,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-22.04, ubuntu-24.04 ] - llvm-version: [ 14, 18 ] + llvm-version: [ 14, 18, 19 ] preset: - name: release-counter - name: release-safeptr-counter @@ -193,6 +209,8 @@ jobs: os: ubuntu-24.04 - llvm-version: 18 os: ubuntu-22.04 + - llvm-version: 19 + os: ubuntu-22.04 runs-on: ${{ matrix.os }} @@ -207,6 +225,12 @@ jobs: ref: ci/omp path: omp-test-bench + - name: LLVM apt + if: ${{ matrix.llvm-version == 19 }} + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main" | sudo tee /etc/apt/sources.list.d/llvm-19.list + - name: Update apt run: sudo apt-get update diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a5e0bf8..dd7476d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.20) project(typeart - VERSION 1.9 + VERSION 2.0 HOMEPAGE_URL https://github.com/tudasc/TypeART DESCRIPTION "LLVM-based type and memory allocation tracking sanitizer" ) diff --git a/externals/dimeta/CMakeLists.txt b/externals/dimeta/CMakeLists.txt index fbeb2bc7..d717bbdb 100644 --- a/externals/dimeta/CMakeLists.txt +++ b/externals/dimeta/CMakeLists.txt @@ -1,7 +1,7 @@ FetchContent_Declare( llvm-dimeta GIT_REPOSITORY https://github.com/ahueck/llvm-dimeta - GIT_TAG devel + GIT_TAG v0.2.0 GIT_SHALLOW 1 ) diff --git a/lib/passes/instrumentation/MemOpInstrumentation.cpp b/lib/passes/instrumentation/MemOpInstrumentation.cpp index fd5f56ce..5a763dc2 100644 --- a/lib/passes/instrumentation/MemOpInstrumentation.cpp +++ b/lib/passes/instrumentation/MemOpInstrumentation.cpp @@ -35,6 +35,7 @@ #include "llvm/IR/Instruction.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/IntrinsicInst.h" +#include "llvm/IR/Module.h" #include "llvm/IR/Type.h" #include "llvm/Support/Casting.h" #include "llvm/Support/raw_ostream.h" diff --git a/lib/passes/typegen/dimeta/DimetaTypeGen.cpp b/lib/passes/typegen/dimeta/DimetaTypeGen.cpp index 4ef82654..57384498 100644 --- a/lib/passes/typegen/dimeta/DimetaTypeGen.cpp +++ b/lib/passes/typegen/dimeta/DimetaTypeGen.cpp @@ -54,13 +54,25 @@ template std::pair, 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) { + 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}; } @@ -220,6 +232,8 @@ std::optional 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: @@ -279,11 +293,11 @@ std::optional get_builtin_typeid(const dimeta::QualifiedFu } case FundamentalType::Encoding::kComplex: { switch (extent) { - case 2: + case 8: return TYPEART_COMPLEX_64; - case 4: + case 16: return TYPEART_COMPLEX_128; - case 1: + case 32: return TYPEART_COMPLEX_256; default: return TYPEART_UNKNOWN_TYPE; @@ -398,17 +412,31 @@ class DimetaTypeManager final : public TypeIDGenerator { if (q.is_forward_decl) { struct_info.flag = StructTypeFlag::FWD_DECL; } else { - struct_info.flag = StructTypeFlag::USER_DEFINED; + if (q.type.type == CompoundType::Tag::kUnion) { + struct_info.flag = StructTypeFlag::UNION; + } else { + struct_info.flag = StructTypeFlag::USER_DEFINED; + } } - struct_info.extent = compound.extent; - struct_info.offsets = compound.offsets; - struct_info.num_members = compound.bases.size() + compound.members.size(); + struct_info.extent = compound.extent; + size_t num_bases{0}; for (const auto& base : compound.bases) { + if (base->is_empty_base_class) { + continue; + } + num_bases++; struct_info.member_types.push_back(getOrRegister(base->base)); struct_info.array_sizes.push_back(array_size(base->base)); + struct_info.offsets.push_back(base->offset); } + + struct_info.num_members = compound.members.size() + num_bases; + struct_info.offsets.insert(std::end(struct_info.offsets), // + std::begin(compound.offsets), // + std::end(compound.offsets)); + for (const auto& member : compound.members) { struct_info.member_types.push_back(getOrRegister(member->member)); struct_info.array_sizes.push_back(array_size(member->member)); diff --git a/lib/runtime/RuntimeInterface.h b/lib/runtime/RuntimeInterface.h index d785d86c..774519f2 100644 --- a/lib/runtime/RuntimeInterface.h +++ b/lib/runtime/RuntimeInterface.h @@ -267,13 +267,21 @@ bool typeart_is_struct_type(int type_id); /** * Returns true if the type ID is a user-defined structure type - * (struct, class etc.) + * (struct, class, union etc.) * * \param[in] type_id The type ID. * \return true, false */ bool typeart_is_userdefined_type(int type_id); +/** + * Returns true if the type ID is a (user-defined) union + * + * \param[in] type_id The type ID. + * \return true, false + */ +bool typeart_is_union(int type_id); + /** * Returns true if the type ID is a LLVM SIMD vector type * diff --git a/lib/runtime/TypeResolution.cpp b/lib/runtime/TypeResolution.cpp index d41d1688..71e4bdaf 100644 --- a/lib/runtime/TypeResolution.cpp +++ b/lib/runtime/TypeResolution.cpp @@ -451,6 +451,11 @@ bool typeart_is_userdefined_type(int type_id) { return typeart::RuntimeSystem::get().typeResolution.db().isUserDefinedType(type_id); } +bool typeart_is_union(int type_id) { + typeart::RTGuard guard; + return typeart::RuntimeSystem::get().typeResolution.db().isUnion(type_id); +} + size_t typeart_get_type_size(int type_id) { typeart::RTGuard guard; return typeart::RuntimeSystem::get().typeResolution.db().getTypeSize(type_id); diff --git a/lib/typelib/TypeDB.cpp b/lib/typelib/TypeDB.cpp index 96abef59..1dda449d 100644 --- a/lib/typelib/TypeDB.cpp +++ b/lib/typelib/TypeDB.cpp @@ -36,6 +36,7 @@ inline constexpr auto size_complex_long_double = sizeof(std::complexname << " " << static_cast(structInfo->flag) << " " - << (static_cast(structInfo->flag) == static_cast(StructTypeFlag::USER_DEFINED))) + << (static_cast(structInfo->flag) == static_cast(StructTypeFlag::USER_DEFINED)) + << " " << (static_cast(structInfo->flag) == static_cast(StructTypeFlag::UNION))) return (structInfo != nullptr) && - (static_cast(structInfo->flag) == static_cast(StructTypeFlag::USER_DEFINED)); + (static_cast(structInfo->flag) == static_cast(StructTypeFlag::USER_DEFINED) || + static_cast(structInfo->flag) == static_cast(StructTypeFlag::UNION)); } bool TypeDB::isVectorType(int type_id) const { @@ -127,6 +130,13 @@ bool TypeDB::isVectorType(int type_id) const { (static_cast(structInfo->flag) == static_cast(StructTypeFlag::LLVM_VECTOR)); } +bool TypeDB::isUnion(int type_id) const { + const auto* structInfo = getStructInfo(type_id); + LOG_DEBUG(structInfo->name << " " << static_cast(structInfo->flag) << " " + << (static_cast(structInfo->flag) == static_cast(StructTypeFlag::UNION))) + return (structInfo != nullptr) && (static_cast(structInfo->flag) == static_cast(StructTypeFlag::UNION)); +} + bool TypeDB::isValid(int type_id) const { if (isBuiltinType(type_id)) { return true; diff --git a/lib/typelib/TypeDB.h b/lib/typelib/TypeDB.h index 125781af..25227547 100644 --- a/lib/typelib/TypeDB.h +++ b/lib/typelib/TypeDB.h @@ -91,6 +91,8 @@ class TypeDB final : public TypeDatabase { bool isVectorType(int type_id) const override; + bool isUnion(int type_id) const override; + const std::string& getTypeName(int type_id) const override; const StructTypeInfo* getStructInfo(int type_id) const override; diff --git a/lib/typelib/TypeDatabase.h b/lib/typelib/TypeDatabase.h index 73c9a551..b32b521b 100644 --- a/lib/typelib/TypeDatabase.h +++ b/lib/typelib/TypeDatabase.h @@ -22,7 +22,7 @@ namespace typeart { -enum class StructTypeFlag : int { USER_DEFINED = 1, LLVM_VECTOR = 2, FWD_DECL = 4 }; +enum class StructTypeFlag : int { USER_DEFINED = 1, LLVM_VECTOR = 2, FWD_DECL = 4, UNION = 8 }; struct StructTypeInfo { int type_id; @@ -57,6 +57,8 @@ class TypeDatabase { [[nodiscard]] virtual bool isVectorType(int type_id) const = 0; + [[nodiscard]] virtual bool isUnion(int type_id) const = 0; + [[nodiscard]] virtual const std::string& getTypeName(int type_id) const = 0; [[nodiscard]] virtual const StructTypeInfo* getStructInfo(int type_id) const = 0; diff --git a/lib/typelib/TypeIO.cpp b/lib/typelib/TypeIO.cpp index 47fe3b68..6c99bf26 100644 --- a/lib/typelib/TypeIO.cpp +++ b/lib/typelib/TypeIO.cpp @@ -54,7 +54,7 @@ struct llvm::yaml::ScalarTraits { } else { value = static_cast(flag); } - return StringRef(); + return {}; } // Determine if this scalar needs quotes. diff --git a/lib/typelib/TypeInterface.h b/lib/typelib/TypeInterface.h index 27b465de..f22083e9 100644 --- a/lib/typelib/TypeInterface.h +++ b/lib/typelib/TypeInterface.h @@ -21,6 +21,7 @@ typedef enum typeart_builtin_type_t { // NOLINT TYPEART_UNKNOWN_TYPE = 0, TYPEART_POINTER, + TYPEART_VTABLE_POINTER, TYPEART_VOID, TYPEART_NULLPOINTER, diff --git a/test/pass/arrays/01_simple_array.c b/test/pass/arrays/01_simple_array.c index 570106ea..899f32ad 100644 --- a/test/pass/arrays/01_simple_array.c +++ b/test/pass/arrays/01_simple_array.c @@ -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) diff --git a/test/pass/arrays/02_array_to_pointer.c b/test/pass/arrays/02_array_to_pointer.c index cd0bb93e..972298db 100644 --- a/test/pass/arrays/02_array_to_pointer.c +++ b/test/pass/arrays/02_array_to_pointer.c @@ -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) diff --git a/test/pass/arrays/03_multidim_array.c b/test/pass/arrays/03_multidim_array.c index 90cc57bb..e68f2c00 100644 --- a/test/pass/arrays/03_multidim_array.c +++ b/test/pass/arrays/03_multidim_array.c @@ -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) diff --git a/test/pass/arrays/06_malloc_of_array.c b/test/pass/arrays/06_malloc_of_array.c index d75b0e6b..e115a5f8 100644 --- a/test/pass/arrays/06_malloc_of_array.c +++ b/test/pass/arrays/06_malloc_of_array.c @@ -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) \ No newline at end of file +// CHECK: @__typeart_alloc({{i8\*|ptr}} %{{[0-9a-z]+}}, i32 13, i64 6) \ No newline at end of file diff --git a/test/pass/filter/01_alloca.llin b/test/pass/filter/01_alloca.llin index d585806c..5d454a0f 100644 --- a/test/pass/filter/01_alloca.llin +++ b/test/pass/filter/01_alloca.llin @@ -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) @@ -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) diff --git a/test/pass/filter/12_omp_correlate.c b/test/pass/filter/12_omp_correlate.c index 20b5e97d..899e605c 100644 --- a/test/pass/filter/12_omp_correlate.c +++ b/test/pass/filter/12_omp_correlate.c @@ -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; diff --git a/test/pass/filter/13_omp_loops.c b/test/pass/filter/13_omp_loops.c index 2f51dc38..6859f1a1 100644 --- a/test/pass/filter/13_omp_loops.c +++ b/test/pass/filter/13_omp_loops.c @@ -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; diff --git a/test/pass/filter/14_omp_nested.c b/test/pass/filter/14_omp_nested.c index 9fb30a9d..8991e40a 100644 --- a/test/pass/filter/14_omp_nested.c +++ b/test/pass/filter/14_omp_nested.c @@ -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 diff --git a/test/pass/filter/15_omp_task.c b/test/pass/filter/15_omp_task.c index 7efa5c81..ea3d6105 100644 --- a/test/pass/filter/15_omp_task.c +++ b/test/pass/filter/15_omp_task.c @@ -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 diff --git a/test/pass/filter/16_omp_reduction.c b/test/pass/filter/16_omp_reduction.c index d34ae094..1fe4a561 100644 --- a/test/pass/filter/16_omp_reduction.c +++ b/test/pass/filter/16_omp_reduction.c @@ -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); diff --git a/test/pass/filter/18_omp_last_priv_nested.c b/test/pass/filter/18_omp_last_priv_nested.c index 8fe5fa54..3070c0a2 100644 --- a/test/pass/filter/18_omp_last_priv_nested.c +++ b/test/pass/filter/18_omp_last_priv_nested.c @@ -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 diff --git a/test/pass/filter/19_omp_first_priv_nested.c b/test/pass/filter/19_omp_first_priv_nested.c index 2c9946a3..6ac771e8 100644 --- a/test/pass/filter/19_omp_first_priv_nested.c +++ b/test/pass/filter/19_omp_first_priv_nested.c @@ -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 @@ -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 diff --git a/test/pass/filter/20_omp_priv_combi_nested.c b/test/pass/filter/20_omp_priv_combi_nested.c index cc586e28..80b99331 100644 --- a/test/pass/filter/20_omp_priv_combi_nested.c +++ b/test/pass/filter/20_omp_priv_combi_nested.c @@ -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 @@ -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 diff --git a/test/pass/filter/22_omp_ident_offset.llin b/test/pass/filter/22_omp_ident_offset.llin index 68d4c514..8983c85c 100644 --- a/test/pass/filter/22_omp_ident_offset.llin +++ b/test/pass/filter/22_omp_ident_offset.llin @@ -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 diff --git a/test/pass/malloc_free/01_simple_malloc_int.c b/test/pass/malloc_free/01_simple_malloc_int.c index 135b8db9..7e52a35b 100644 --- a/test/pass/malloc_free/01_simple_malloc_int.c +++ b/test/pass/malloc_free/01_simple_malloc_int.c @@ -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) diff --git a/test/pass/malloc_free/02_simple_malloc_free_int.c b/test/pass/malloc_free/02_simple_malloc_free_int.c index 402ea23b..80a58be1 100644 --- a/test/pass/malloc_free/02_simple_malloc_free_int.c +++ b/test/pass/malloc_free/02_simple_malloc_free_int.c @@ -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]]) diff --git a/test/pass/malloc_free/03_simple_malloc_free_double.c b/test/pass/malloc_free/03_simple_malloc_free_double.c index 510edf6b..79ace56a 100644 --- a/test/pass/malloc_free/03_simple_malloc_free_double.c +++ b/test/pass/malloc_free/03_simple_malloc_free_double.c @@ -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]]) diff --git a/test/pass/malloc_free/04_simple_malloc_int_double.c b/test/pass/malloc_free/04_simple_malloc_int_double.c index 842489c5..b1326a8a 100644 --- a/test/pass/malloc_free/04_simple_malloc_int_double.c +++ b/test/pass/malloc_free/04_simple_malloc_int_double.c @@ -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 diff --git a/test/pass/malloc_free/06_simple_malloc_void_type.c b/test/pass/malloc_free/06_simple_malloc_void_type.c index eae0511f..b32686d2 100644 --- a/test/pass/malloc_free/06_simple_malloc_void_type.c +++ b/test/pass/malloc_free/06_simple_malloc_void_type.c @@ -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 diff --git a/test/pass/malloc_free/08_simple_malloc_struct_void.c b/test/pass/malloc_free/08_simple_malloc_struct_void.c index 5d101035..f2661211 100644 --- a/test/pass/malloc_free/08_simple_malloc_struct_void.c +++ b/test/pass/malloc_free/08_simple_malloc_struct_void.c @@ -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]]) diff --git a/test/pass/malloc_free/09_malloc_with_disjunct_free.c b/test/pass/malloc_free/09_malloc_with_disjunct_free.c index e66baede..b4a55d9b 100644 --- a/test/pass/malloc_free/09_malloc_with_disjunct_free.c +++ b/test/pass/malloc_free/09_malloc_with_disjunct_free.c @@ -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]]) diff --git a/test/pass/malloc_free/11_calloc_realloc.c b/test/pass/malloc_free/11_calloc_realloc.c index 1b4e92f8..25e3d4d3 100644 --- a/test/pass/malloc_free/11_calloc_realloc.c +++ b/test/pass/malloc_free/11_calloc_realloc.c @@ -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 diff --git a/test/pass/malloc_free/12_malloc_memcpy.c b/test/pass/malloc_free/12_malloc_memcpy.c index bca21419..641b4343 100644 --- a/test/pass/malloc_free/12_malloc_memcpy.c +++ b/test/pass/malloc_free/12_malloc_memcpy.c @@ -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 */) { diff --git a/test/pass/malloc_free/13_calloc_void_type.c b/test/pass/malloc_free/13_calloc_void_type.c index 9afa1601..35018047 100644 --- a/test/pass/malloc_free/13_calloc_void_type.c +++ b/test/pass/malloc_free/13_calloc_void_type.c @@ -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 diff --git a/test/pass/malloc_free/14_aligned_alloc.c b/test/pass/malloc_free/14_aligned_alloc.c index 5bbf3085..333336bd 100644 --- a/test/pass/malloc_free/14_aligned_alloc.c +++ b/test/pass/malloc_free/14_aligned_alloc.c @@ -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 diff --git a/test/pass/malloc_free/15_aligned_alloc_void_type.c b/test/pass/malloc_free/15_aligned_alloc_void_type.c index dcc8d137..dca85da5 100644 --- a/test/pass/malloc_free/15_aligned_alloc_void_type.c +++ b/test/pass/malloc_free/15_aligned_alloc_void_type.c @@ -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 diff --git a/test/pass/malloc_free/16_omp_heap.c b/test/pass/malloc_free/16_omp_heap.c index eabf8fb5..13757a04 100644 --- a/test/pass/malloc_free/16_omp_heap.c +++ b/test/pass/malloc_free/16_omp_heap.c @@ -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 diff --git a/test/pass/malloc_free/17_realloc_void.c b/test/pass/malloc_free/17_realloc_void.c index f48494e6..624bca2c 100644 --- a/test/pass/malloc_free/17_realloc_void.c +++ b/test/pass/malloc_free/17_realloc_void.c @@ -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 diff --git a/test/pass/new_delete/01_inv_simple_new_int.cpp b/test/pass/new_delete/01_inv_simple_new_int.cpp index 5df7a952..e2cd9833 100644 --- a/test/pass/new_delete/01_inv_simple_new_int.cpp +++ b/test/pass/new_delete/01_inv_simple_new_int.cpp @@ -9,7 +9,7 @@ #include // 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; diff --git a/test/pass/new_delete/02_inv_simple_int_array.cpp b/test/pass/new_delete/02_inv_simple_int_array.cpp index bc175e32..f2893a38 100644 --- a/test/pass/new_delete/02_inv_simple_int_array.cpp +++ b/test/pass/new_delete/02_inv_simple_int_array.cpp @@ -9,7 +9,7 @@ #include // 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]; diff --git a/test/pass/new_delete/08_inv_double_array_delete.cpp b/test/pass/new_delete/08_inv_double_array_delete.cpp index 2d71467a..3de48a4b 100644 --- a/test/pass/new_delete/08_inv_double_array_delete.cpp +++ b/test/pass/new_delete/08_inv_double_array_delete.cpp @@ -9,7 +9,7 @@ #include // CHECK: invoke{{.*}} {{i8\*|ptr}} @_Znam(i64{{( noundef)?}} 16) -// CHECK: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER:%[0-9a-z]+]], i32 23, i64 2) +// CHECK: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER:%[0-9a-z]+]], i32 24, i64 2) // CHECK: call void @_ZdaPv({{i8\*|ptr}}{{( noundef)?}} [[POINTER2:%[0-9a-z]+]]) // CHECK-NEXT: call void @__typeart_free({{i8\*|ptr}} {{.*}}[[POINTER2]]) int main() { @@ -23,7 +23,7 @@ int main() { } // CHECK: invoke{{.*}} {{i8\*|ptr}} @_Znam(i64{{( noundef)?}} 16) -// CHECK: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER:%[0-9a-z]+]], i32 23, i64 2) +// CHECK: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER:%[0-9a-z]+]], i32 24, i64 2) // CHECK: call void @_ZdaPv({{i8\*|ptr}}{{( noundef)?}} [[POINTER2:%[0-9a-z]+]]) // CHECK-NEXT: call void @__typeart_free({{i8\*|ptr}} {{.*}}[[POINTER2]]) void foo() { diff --git a/test/pass/new_delete/09_inv_struct_delete.cpp b/test/pass/new_delete/09_inv_struct_delete.cpp index 51f74335..0e27e635 100644 --- a/test/pass/new_delete/09_inv_struct_delete.cpp +++ b/test/pass/new_delete/09_inv_struct_delete.cpp @@ -40,5 +40,5 @@ int main() { } // CHECK: @_ZN2S1D0Ev -// CHECK: call void @_ZdlPv({{i8\*|ptr}}{{( noundef)?}} [[POINTER2:%[0-9a-z]+]]) +// CHECK: call void @_ZdlPv{{m?}}({{i8\*|ptr}}{{( noundef)?}} [[POINTER2:%[0-9a-z]+]] // CHECK-NEXT: call void @__typeart_free({{i8\*|ptr}} {{.*}}[[POINTER2]]) diff --git a/test/pass/new_delete/10_inv_struct_array_delete.cpp b/test/pass/new_delete/10_inv_struct_array_delete.cpp index 4f879bfd..4ebd4309 100644 --- a/test/pass/new_delete/10_inv_struct_array_delete.cpp +++ b/test/pass/new_delete/10_inv_struct_array_delete.cpp @@ -17,7 +17,7 @@ struct S1 { // CHECK: invoke{{.*}} {{i8\*|ptr}} @_Znam(i64{{( noundef)?}} 56) // CHECK: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER:%[0-9a-z]+]], i32 {{2[0-9]+}}, i64 3) // CHECK: [[MEMORYBLOB:%[0-9a-z]+]] = getelementptr inbounds i8, {{i8\*|ptr}} [[ARRPTR:%[0-9a-z]+]], i64 -8 -// CHECK: call void @_ZdaPv({{i8\*|ptr}}{{( noundef)?}} [[MEMORYBLOB]]) +// CHECK: call void @_ZdaPv{{m?}}({{i8\*|ptr}}{{( noundef)?}} [[MEMORYBLOB]] // CHECK-NEXT: call void @__typeart_free({{i8\*|ptr}} [[ARRPTR]]) void foo() { S1* b{nullptr}; @@ -33,7 +33,7 @@ void foo() { // CHECK: invoke{{.*}} {{i8\*|ptr}} @_Znam(i64{{( noundef)?}} 40) // CHECK: call void @__typeart_alloc({{i8\*|ptr}} [[POINTER:%[0-9a-z]+]], i32 {{2[0-9]+}}, i64 2) // CHECK: [[MEMORYBLOB:%[0-9a-z]+]] = getelementptr inbounds i8, {{i8\*|ptr}} [[ARRPTR:%[0-9a-z]+]], i64 -8 -// CHECK: call void @_ZdaPv({{i8\*|ptr}}{{( noundef)?}} [[MEMORYBLOB]]) +// CHECK: call void @_ZdaPv{{m?}}({{i8\*|ptr}}{{( noundef)?}} [[MEMORYBLOB]] // CHECK-NEXT: call void @__typeart_free({{i8\*|ptr}} [[ARRPTR]]) int main() { try { @@ -46,5 +46,5 @@ int main() { } // CHECK: @_ZN2S1D0Ev -// CHECK: call void @_ZdlPv({{i8\*|ptr}}{{( noundef)?}} [[POINTER2:%[0-9a-z]+]]) +// CHECK: call void @_ZdlPv{{m?}}({{i8\*|ptr}}{{( noundef)?}} [[POINTER2:%[0-9a-z]+]] // CHECK-NEXT: call void @__typeart_free({{i8\*|ptr}} [[POINTER2]]) diff --git a/test/pass/new_delete/18_array_cookie_delete.cpp b/test/pass/new_delete/18_array_cookie_delete.cpp index f18ec2b7..4fdaff6e 100644 --- a/test/pass/new_delete/18_array_cookie_delete.cpp +++ b/test/pass/new_delete/18_array_cookie_delete.cpp @@ -13,7 +13,7 @@ struct S1 { }; // CHECK: [[MEM:%[0-9a-z]+]] = getelementptr inbounds i8, {{i8\*|ptr}} [[ARR:%[0-9a-z]+]], i64 -8 -// CHECK: call void @_ZdaPv({{i8\*|ptr}}{{( noundef)?}} [[MEM]]) +// CHECK: call void @_ZdaPv{{m?}}({{i8\*|ptr}}{{( noundef)?}} [[MEM]] // CHECK: call void @__typeart_free({{i8\*|ptr}} [[ARR]]) int main() { S1* ss = new S1[2]; diff --git a/test/pass/new_delete/19_array_cookie_dynamic_size_opaque.cpp b/test/pass/new_delete/19_array_cookie_dynamic_size_opaque.cpp index d88d28fc..0174641d 100644 --- a/test/pass/new_delete/19_array_cookie_dynamic_size_opaque.cpp +++ b/test/pass/new_delete/19_array_cookie_dynamic_size_opaque.cpp @@ -1,6 +1,6 @@ // clang-format off // RUN: %cpp-to-llvm %s | %apply-typeart -S 2>&1 | %filecheck %s -// REQUIRES: llvm-18 +// REQUIRES: llvm-18 || llvm-19 // clang-format on // CHECK: TypeArtPass [Heap] diff --git a/test/pass/new_delete/20_no_array_cookie_lulesh_ad.llin b/test/pass/new_delete/20_no_array_cookie_lulesh_ad.llin index 4850d718..03309760 100644 --- a/test/pass/new_delete/20_no_array_cookie_lulesh_ad.llin +++ b/test/pass/new_delete/20_no_array_cookie_lulesh_ad.llin @@ -1,5 +1,5 @@ ; RUN: %apply-typeart -S < %s | %filecheck %s -; REQUIRES: llvm-18 +; REQUIRES: llvm-18 || llvm-19 ; llvm-reduce on lulesh.cc with culprit chunk.hpp:allocateData() where pattern is similar to array cookie. diff --git a/test/pass/stack/01_stack_lifetime.c b/test/pass/stack/01_stack_lifetime.c index f022aa9b..ff0fc833 100644 --- a/test/pass/stack/01_stack_lifetime.c +++ b/test/pass/stack/01_stack_lifetime.c @@ -18,7 +18,7 @@ void correct(int rank) { // CHECK: [[POINTER:%[0-9a-z]+]] = bitcast [3 x [3 x i32]]* [[BUF:%[0-9a-z]+]] to i8* // CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 36, i8* [[POINTER]]) -// CHECK-NEXT: call void @__typeart_alloc_stack(i8* [[POINTER]], i32 12, i64 9) +// CHECK-NEXT: call void @__typeart_alloc_stack(i8* [[POINTER]], i32 13, i64 9) // CHECK: call void @llvm.lifetime.start.p0i8(i64 12, i8* [[POINTER2:%[0-9a-z]+]]) -// CHECK-NEXT: call void @__typeart_alloc_stack(i8* [[POINTER2]], i32 12, i64 3) +// CHECK-NEXT: call void @__typeart_alloc_stack(i8* [[POINTER2]], i32 13, i64 3) diff --git a/test/runtime/19_softcounter.c b/test/runtime/19_softcounter.c index 66b209e5..4d744a9e 100644 --- a/test/runtime/19_softcounter.c +++ b/test/runtime/19_softcounter.c @@ -33,7 +33,7 @@ int main(void) { // CHECK-NEXT: Bytes per node map/stack : 96 , 8 , - // CHECK-NEXT: {{(#|-)+}} // CHECK-NEXT: Allocation type detail (heap, stack, global) -// CHECK-NEXT: 23 : 5 , 0 , 0 , double +// CHECK-NEXT: 24 : 5 , 0 , 0 , double // CHECK-NEXT: {{(#|-)+}} // CHECK-NEXT: Free allocation type detail (heap, stack) -// CHECK-NEXT: 23 : 5 , 0 , double \ No newline at end of file +// CHECK-NEXT: 24 : 5 , 0 , double \ No newline at end of file diff --git a/test/runtime/20_softcounter_max.c b/test/runtime/20_softcounter_max.c index 63b645ca..0edad9c6 100644 --- a/test/runtime/20_softcounter_max.c +++ b/test/runtime/20_softcounter_max.c @@ -33,7 +33,7 @@ int main(void) { // CHECK-NEXT: Bytes per node map/stack : 96 , 8 , - // CHECK-NEXT: {{(#|-)+}} // CHECK-NEXT: Allocation type detail (heap, stack, global) -// CHECK-NEXT: 23 : 6 , 0 , 0 , double +// CHECK-NEXT: 24 : 6 , 0 , 0 , double // CHECK-NEXT: {{(#|-)+}} // CHECK-NEXT: Free allocation type detail (heap, stack) -// CHECK-NEXT: 23 : 0 , 0 , double \ No newline at end of file +// CHECK-NEXT: 24 : 0 , 0 , double \ No newline at end of file diff --git a/test/runtime/21_runtime_manual.cpp b/test/runtime/21_runtime_manual.cpp index 0d5f5209..5b81bb9a 100644 --- a/test/runtime/21_runtime_manual.cpp +++ b/test/runtime/21_runtime_manual.cpp @@ -28,8 +28,8 @@ std::vector sorted_v(const std::unordered_set& set) { } void test_heap(softcounter::AccessRecorder& recorder) { - recorder.incHeapAlloc(10, 1); - recorder.incHeapAlloc(10, 1); + recorder.incHeapAlloc(11, 1); + recorder.incHeapAlloc(11, 1); // CHECK: 2 o_(getCurHeapAllocs()); @@ -39,7 +39,7 @@ void test_heap(softcounter::AccessRecorder& recorder) { auto hallocs = sorted_v(recorder.getHeapAlloc()); // CHECK: 1 std::cerr << hallocs.size() << '\n'; - // CHECK: 10 2 + // CHECK: 11 2 for (const auto& [id, count] : hallocs) { std::cerr << id << " " << count << '\n'; } @@ -123,7 +123,7 @@ void test_global(softcounter::AccessRecorder& recorder) { const auto& alloc = recorder.getGlobalAlloc(); // CHECK: 1 std::cerr << alloc.size() << '\n'; - // CHECK: 23 1 + // CHECK: 24 1 for (const auto& [id, count] : alloc) { std::cerr << id << " " << count << '\n'; } diff --git a/test/runtime/22_threads_stack.cpp b/test/runtime/22_threads_stack.cpp index 35563f6d..f42c522e 100644 --- a/test/runtime/22_threads_stack.cpp +++ b/test/runtime/22_threads_stack.cpp @@ -28,11 +28,11 @@ int main(int argc, char** argv) { // CHECK-NOT: Error - // CHECK: [Trace] Free 0x{{.*}} {{(10|5)}} {{(int8_t|char)}} 1 7 - // CHECK: [Trace] Free 0x{{.*}} 23 double 8 1 + // CHECK: [Trace] Free 0x{{.*}} {{(11|6)}} {{(int8_t|char)}} 1 7 + // CHECK: [Trace] Free 0x{{.*}} 24 double 8 1 - // CHECK: [Trace] Free 0x{{.*}} {{(10|5)}} {{(int8_t|char)}} 1 7 - // CHECK: [Trace] Free 0x{{.*}} 23 double 8 1 + // CHECK: [Trace] Free 0x{{.*}} {{(11|6)}} {{(int8_t|char)}} 1 7 + // CHECK: [Trace] Free 0x{{.*}} 24 double 8 1 return 0; } diff --git a/test/runtime/23_threads_heap.cpp b/test/runtime/23_threads_heap.cpp index 07e56e70..2fd615b3 100644 --- a/test/runtime/23_threads_heap.cpp +++ b/test/runtime/23_threads_heap.cpp @@ -32,9 +32,9 @@ int main(int argc, char** argv) { // CHECK-NOT: Error // CHECK: Allocation type detail (heap, stack, global) - // CHECK: 23 : 3000 , 0 , 0 , double + // CHECK: 24 : 3000 , 0 , 0 , double // CHECK: Free allocation type detail (heap, stack) - // CHECK: 23 : 3000 , 0 , double + // CHECK: 24 : 3000 , 0 , double return 0; } diff --git a/test/runtime/24_threads_type_check.cpp b/test/runtime/24_threads_type_check.cpp index aec7efca..f49b3d14 100644 --- a/test/runtime/24_threads_type_check.cpp +++ b/test/runtime/24_threads_type_check.cpp @@ -58,9 +58,9 @@ int main(int argc, char** argv) { // CHECK-TSAN-NOT: ThreadSanitizer // CHECK: Allocation type detail (heap, stack, global) - // CHECK: 23 : 3000 , 0 , 0 , double + // CHECK: 24 : 3000 , 0 , 0 , double // CHECK: Free allocation type detail (heap, stack) - // CHECK: 23 : 3000 , 0 , double + // CHECK: 24 : 3000 , 0 , double return 0; } diff --git a/test/runtime/25_omp_stack.c b/test/runtime/25_omp_stack.c index f296af5f..c352a4b2 100644 --- a/test/runtime/25_omp_stack.c +++ b/test/runtime/25_omp_stack.c @@ -23,11 +23,11 @@ int main(int argc, char** argv) { // CHECK-NOT: Error - // CHECK: [Trace] Free 0x{{.*}} {{(10|5)}} {{(int8_t|char)}} 1 4 - // CHECK-DAG: [Trace] Free 0x{{.*}} 23 double 8 1 + // CHECK: [Trace] Free 0x{{.*}} {{(11|6)}} {{(int8_t|char)}} 1 4 + // CHECK-DAG: [Trace] Free 0x{{.*}} 24 double 8 1 - // CHECK-DAG: [Trace] Free 0x{{.*}} {{(10|5)}} {{(int8_t|char)}} 1 4 - // CHECK-DAG: [Trace] Free 0x{{.*}} 23 double 8 1 + // CHECK-DAG: [Trace] Free 0x{{.*}} {{(11|6)}} {{(int8_t|char)}} 1 4 + // CHECK-DAG: [Trace] Free 0x{{.*}} 24 double 8 1 return 0; } diff --git a/test/runtime/26_omp_heap.c b/test/runtime/26_omp_heap.c index 2005c6df..706085f0 100644 --- a/test/runtime/26_omp_heap.c +++ b/test/runtime/26_omp_heap.c @@ -31,9 +31,9 @@ int main(int argc, char** argv) { // CHECK-NOT: Error // CHECK: Allocation type detail (heap, stack, global) - // CHECK: 23 : 3000 , 0 , 0 , double + // CHECK: 24 : 3000 , 0 , 0 , double // CHECK: Free allocation type detail (heap, stack) - // CHECK: 23 : 3000 , 0 , double + // CHECK: 24 : 3000 , 0 , double return 0; } \ No newline at end of file diff --git a/test/runtime/27_omp_softcounter.c b/test/runtime/27_omp_softcounter.c index 611f13f2..7497df72 100644 --- a/test/runtime/27_omp_softcounter.c +++ b/test/runtime/27_omp_softcounter.c @@ -4,7 +4,7 @@ // RUN: %run %s -o -O2 --omp --typeart-filter=true 2>&1 | %filecheck %s // RUN: %run %s --omp --typeart-filter=true 2>&1 | %filecheck %s -// REQUIRES: openmp && softcounter && !llvm-18 +// REQUIRES: openmp && softcounter && !llvm-18 && !llvm-19 // clang-format on #include @@ -58,7 +58,7 @@ int main(int argc, char** argv) { // CHECK-NEXT: Allocation type detail (heap, stack, global) // CHECK: {{(#|-)+}} // CHECK-NEXT: Free allocation type detail (heap, stack) - // CHECK-NEXT: 23 : 200 , 0 , double + // CHECK-NEXT: 24 : 200 , 0 , double // CHECK: Per-thread counter values (2 threads) // CHECK-NEXT: Thread Heap Allocs : 100 , 100 // CHECK-NEXT: Thread Heap Arrays : 100 , 100 diff --git a/test/runtime/28_omp_softcounter_stack.c b/test/runtime/28_omp_softcounter_stack.c index 3d7b91ac..b5e2b9f5 100644 --- a/test/runtime/28_omp_softcounter_stack.c +++ b/test/runtime/28_omp_softcounter_stack.c @@ -55,8 +55,8 @@ int main(int argc, char** argv) { // CHECK-NEXT: Allocation type detail (heap, stack, global) // CHECK: {{(#|-)+}} // CHECK-NEXT: Free allocation type detail (heap, stack) - // CHECK: 22 : 0 , 200 , float - // CHECK: 23 : 0 , 200 , double + // CHECK: 23 : 0 , 200 , float + // CHECK: 24 : 0 , 200 , double // CHECK: Per-thread counter values (2 threads) // CHECK-NEXT: Thread Heap Allocs : 0 , 0 // CHECK-NEXT: Thread Heap Arrays : 0 , 0 diff --git a/test/runtime/30_omp_concurrent_w.cpp b/test/runtime/30_omp_concurrent_w.cpp index 314fa4fc..80690450 100644 --- a/test/runtime/30_omp_concurrent_w.cpp +++ b/test/runtime/30_omp_concurrent_w.cpp @@ -67,9 +67,9 @@ int main(int argc, char** argv) { // CHECK-NOT: Error // CHECK: Allocation type detail (heap, stack, global) -// CHECK: 23 : 300 , 0 , 0 , double +// CHECK: 24 : 300 , 0 , 0 , double // CHECK: Free allocation type detail (heap, stack) -// CHECK: 23 : 300 , 0 , double +// CHECK: 24 : 300 , 0 , double return 0; } diff --git a/test/runtime/31_omp_overwrite.cpp b/test/runtime/31_omp_overwrite.cpp index 3c1ae505..84735101 100644 --- a/test/runtime/31_omp_overwrite.cpp +++ b/test/runtime/31_omp_overwrite.cpp @@ -53,6 +53,6 @@ int main(int argc, char** argv) { // CHECK: Addresses re-used : 200 // CHECK: Allocation type detail (heap, stack, global) - // CHECK: 23 : 300 , 0 , 0 , double + // CHECK: 24 : 300 , 0 , 0 , double return 0; } diff --git a/test/runtime/32_addresses.c b/test/runtime/32_addresses.c index f4526162..680707e9 100644 --- a/test/runtime/32_addresses.c +++ b/test/runtime/32_addresses.c @@ -14,7 +14,7 @@ int main(int argc, char** argv) { } // TODO disable Trace logs for early return? -// CHECK: [Error]{{.*}}:Nullptr allocation 0x0 23 {{.*}} 8 1 -// CHECK: [Warning]{{.*}}:Zero-size allocation 0x1 22 {{.*}} 4 0 -// CHECK: [Error]{{.*}}:Zero-size and nullptr allocation 0x0 23 {{.*}} 8 0 -// CHECK: [Trace] Alloc 0x2 24 {{.*}} 16 1 \ No newline at end of file +// CHECK: [Error]{{.*}}:Nullptr allocation 0x0 23 {{.*}} {{.*}} 1 +// CHECK: [Warning]{{.*}}:Zero-size allocation 0x1 22 {{.*}} {{.*}} 0 +// CHECK: [Error]{{.*}}:Zero-size and nullptr allocation 0x0 23 {{.*}} {{.*}} 0 +// CHECK: [Trace] Alloc 0x2 24 {{.*}} {{.*}} 1 \ No newline at end of file diff --git a/test/runtime/34_off_by_n.cpp b/test/runtime/34_off_by_n.cpp index 4a3413f8..6b6f2862 100644 --- a/test/runtime/34_off_by_n.cpp +++ b/test/runtime/34_off_by_n.cpp @@ -42,10 +42,10 @@ int main(int argc, char** argv) { // CHECK-NOT: [Error] check(&d[0]); check(&d[1]); - // CHECK: {{.*}}:Out of bounds for the lookup: (0x{{[0-9a-f]+}} 23 double 8 1 (0x{{[0-9a-f]+}})) #Elements too far: 1 + // CHECK: {{.*}}:Out of bounds for the lookup: (0x{{[0-9a-f]+}} 24 double 8 1 (0x{{[0-9a-f]+}})) #Elements too far: 1 // CHECK: [Check]: Status: 1 check(&d[2]); // one off - // CHECK: {{.*}}:Out of bounds for the lookup: (0x{{[0-9a-f]+}} 23 double 8 1 (0x{{[0-9a-f]+}})) #Elements too far: 4 + // CHECK: {{.*}}:Out of bounds for the lookup: (0x{{[0-9a-f]+}} 24 double 8 1 (0x{{[0-9a-f]+}})) #Elements too far: 4 // CHECK: [Check]: Status: 1 check(&d[5]); // four off diff --git a/test/runtime/35_free_inexistant.cpp b/test/runtime/35_free_inexistant.cpp index b667ab6e..b5e3fc5a 100644 --- a/test/runtime/35_free_inexistant.cpp +++ b/test/runtime/35_free_inexistant.cpp @@ -40,13 +40,13 @@ int main(int argc, char** argv) { // CHECK: [Error]{{.*}}Free on unregistered address __typeart_free(reinterpret_cast(d)); - // CHECK: [Trace] Alloc 0x{{[0-9a-f]+}} 23 double 8 6 + // CHECK: [Trace] Alloc 0x{{[0-9a-f]+}} 24 double 8 6 __typeart_alloc(reinterpret_cast(&d[0]), type, extent); // CHECK-NOT: [Error] // CHECK-NOT: [Check] check(&d[0]); - // CHECK: [Trace] Free 0x{{[0-9a-f]+}} 23 double 8 6 + // CHECK: [Trace] Free 0x{{[0-9a-f]+}} 24 double 8 6 __typeart_free(reinterpret_cast(d)); // CHECK: [Error]{{.*}}Free on unregistered address __typeart_free(reinterpret_cast(d)); diff --git a/test/runtime/36_stack_dealloc.cpp b/test/runtime/36_stack_dealloc.cpp index eeb1cadc..29a87d73 100644 --- a/test/runtime/36_stack_dealloc.cpp +++ b/test/runtime/36_stack_dealloc.cpp @@ -18,20 +18,20 @@ int main(int argc, char** argv) { // CHECK: [Error]{{.*}}Stack is smaller than requested de-allocation count. alloca_count: 12. size: 0 __typeart_leave_scope(12); - // CHECK: [Trace] Alloc 0x{{[0-9a-f]+}} 23 double 8 6 + // CHECK: [Trace] Alloc 0x{{[0-9a-f]+}} 24 double 8 6 __typeart_alloc_stack(reinterpret_cast(&d[0]), type, extent); // CHECK: [Trace] Freeing stack (1) 1 - // CHECK: [Trace] Free 0x{{[0-9a-f]+}} 23 double 8 6 + // CHECK: [Trace] Free 0x{{[0-9a-f]+}} 24 double 8 6 // CHECK: [Trace] Stack after free: 0 __typeart_leave_scope(1); // CHECK: [Error]{{.*}}Stack is smaller than requested de-allocation count. alloca_count: 1. size: 0 __typeart_leave_scope(1); - // CHECK: [Trace] Alloc 0x{{[0-9a-f]+}} 23 double 8 1 + // CHECK: [Trace] Alloc 0x{{[0-9a-f]+}} 24 double 8 1 __typeart_alloc_stack(reinterpret_cast(&d[0]), type, 1); - // CHECK: [Trace] Alloc 0x{{[0-9a-f]+}} 23 double 8 1 + // CHECK: [Trace] Alloc 0x{{[0-9a-f]+}} 24 double 8 1 __typeart_alloc_stack(reinterpret_cast(&d[1]), type, 1); // CHECK: [Error]{{.*}}Stack is smaller than requested de-allocation count. alloca_count: 3. size: 2 // CHECK: [Trace] Freeing stack (2) 2 diff --git a/test/runtime/38_resolve_struct.c b/test/runtime/38_resolve_struct.c index 0554bf9e..1c3a5cf9 100644 --- a/test/runtime/38_resolve_struct.c +++ b/test/runtime/38_resolve_struct.c @@ -57,14 +57,14 @@ int main(int argc, char** argv) { struct Datastruct data; __typeart_alloc((const void*)&data, 259, 1); - // CHECK: Status OK: 23 1 + // CHECK: Status OK: 24 1 type_check((const void*)&data.middle); struct Datastruct data_2[3]; // CHECK: [Trace] Alloc [[POINTER:0x[0-9a-f]+]] 259 __typeart_alloc((const void*)&data_2[0], 259, 3); - // CHECK: Status OK: 22 2 + // CHECK: Status OK: 23 2 type_check((const void*)&data_2[2].end); // CHECK: Status OK: 259 1 16 [[POINTER]] type_check_containing((const void*)&data_2[2].end); diff --git a/test/runtime/46_source_location.c b/test/runtime/46_source_location.c index 713ffc62..b86b8a35 100644 --- a/test/runtime/46_source_location.c +++ b/test/runtime/46_source_location.c @@ -1,7 +1,5 @@ // RUN: %run %s --compile_flags "-fdebug-default-version=4" 2>&1 | %filecheck %s -// XFAIL: llvm-18 - #include "../../lib/runtime/RuntimeInterface.h" #include @@ -67,7 +65,7 @@ int main(int argc, char** argv) { // CHECK: Address check OK // CHECK: Loc File:{{.*}}46_source_location.c // CHECK: Loc Function: main -// CHECK: Loc Line: 35 +// CHECK: Loc Line: 3{{(3|5)}} // CHECK: Address check OK // CHECK: Address check OK // CHECK: Address check OK diff --git a/test/runtime/50_global_skip.cpp b/test/runtime/50_global_skip.cpp index 58bf4d20..0387726a 100644 --- a/test/runtime/50_global_skip.cpp +++ b/test/runtime/50_global_skip.cpp @@ -18,11 +18,11 @@ int main(int argc, char** argv) { } // CHECK: Allocation type detail (heap, stack, global) -// CHECK: {{(10|5)}} : 0 , {{[0-9]}} , 0 , {{(int8_t|char)}} -// CHECK: 12 : 0 , {{[0-9]}} , 1 , int -// CHECK: 23 : 0 , {{[0-9]}} , 1 , double +// CHECK: {{(11|6)}} : 0 , {{[0-9]}} , 0 , {{(int8_t|char)}} +// CHECK: 13 : 0 , {{[0-9]}} , 1 , int +// CHECK: 24 : 0 , {{[0-9]}} , 1 , double // CHECK-SKIP: Allocation type detail (heap, stack, global) -// CHECK-SKIP: {{(10|5)}} : 0 , {{[0-9]}} , 0 , {{(int8_t|char)}} -// CHECK-SKIP: 12 : 0 , {{[0-9]}} , 0 , int -// CHECK-SKIP: 23 : 0 , {{[0-9]}} , 0 , double +// CHECK-SKIP: {{(11|6)}} : 0 , {{[0-9]}} , 0 , {{(int8_t|char)}} +// CHECK-SKIP: 13 : 0 , {{[0-9]}} , 0 , int +// CHECK-SKIP: 24 : 0 , {{[0-9]}} , 0 , double diff --git a/test/runtime/51_stack_lifetime.c b/test/runtime/51_stack_lifetime.c index 5dfe989f..ead1a64e 100644 --- a/test/runtime/51_stack_lifetime.c +++ b/test/runtime/51_stack_lifetime.c @@ -18,18 +18,18 @@ void type_check(const void* addr) { void correct(int rank) { if (rank == 1) { - // CHECK: Status OK: 12 9 - // CHECK: Status OK: 12 8 - // CHECK: Status OK: 12 7 - // CHECK: Status OK: 12 1 + // CHECK: Status OK: 13 9 + // CHECK: Status OK: 13 8 + // CHECK: Status OK: 13 7 + // CHECK: Status OK: 13 1 int buffer[3][3] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; type_check(buffer); type_check(&buffer[0][1]); type_check(&buffer[0][2]); type_check(&buffer[2][2]); } else { - // CHECK: Status OK: 12 3 - // CHECK: Status OK: 12 1 + // CHECK: Status OK: 13 3 + // CHECK: Status OK: 13 1 int rcv[3] = {0, 1, 2}; type_check(rcv); type_check(&rcv[2]); diff --git a/test/runtime/53_get_type.c b/test/runtime/53_get_type.c index f574dcee..269d8b0a 100644 --- a/test/runtime/53_get_type.c +++ b/test/runtime/53_get_type.c @@ -112,7 +112,7 @@ void type_check_sub(const void* addr, size_t offset) { void test_get_type() { DataStruct data[5]; - // CHECK: Status OK: type_id=22 count=2 + // CHECK: Status OK: type_id=23 count=2 type_check(&data[1].c[0]); } @@ -124,7 +124,7 @@ void test_get_containing() { void test_get_subtype() { DataStruct data[5]; - // CHECK: type_id=22 count=1 offset=0 + // CHECK: type_id=23 count=1 offset=0 type_check_sub(&data[1], offsetof(DataStruct, c[1])); } diff --git a/test/script/03_wrapper_cxx.cpp b/test/script/03_wrapper_cxx.cpp index 7dfe6400..b3afb147 100644 --- a/test/script/03_wrapper_cxx.cpp +++ b/test/script/03_wrapper_cxx.cpp @@ -14,4 +14,4 @@ int main(int argc, char** argv) { return 0; } -// CHECK: [Trace] Alloc 0x2 24 long double 16 1 +// CHECK: [Trace] Alloc 0x2 25 long double 16 1 diff --git a/test/script/04_wrapper_cc.c b/test/script/04_wrapper_cc.c index 02cfe64a..82661013 100644 --- a/test/script/04_wrapper_cc.c +++ b/test/script/04_wrapper_cc.c @@ -14,4 +14,4 @@ int main(int argc, char** argv) { return 0; } -// CHECK: [Trace] Alloc 0x2 24 long double 16 1 +// CHECK: [Trace] Alloc 0x2 25 long double 16 1 diff --git a/test/script/05_wrapper_mpicxx.cpp b/test/script/05_wrapper_mpicxx.cpp index cfac46c5..43dea2e7 100644 --- a/test/script/05_wrapper_mpicxx.cpp +++ b/test/script/05_wrapper_mpicxx.cpp @@ -21,4 +21,4 @@ int main(int argc, char** argv) { return 0; } -// CHECK: [Trace] Alloc 0x2 24 long double 16 1 +// CHECK: [Trace] Alloc 0x2 25 long double 16 1 diff --git a/test/script/06_wrapper_mpicc.c b/test/script/06_wrapper_mpicc.c index 3b1cb5dc..31056714 100644 --- a/test/script/06_wrapper_mpicc.c +++ b/test/script/06_wrapper_mpicc.c @@ -21,4 +21,4 @@ int main(int argc, char** argv) { return 0; } -// CHECK: [Trace] Alloc 0x2 24 long double 16 1 +// CHECK: [Trace] Alloc 0x2 25 long double 16 1 diff --git a/test/script/11_wrapper_emit_ir.c b/test/script/11_wrapper_emit_ir.c index 49c8f554..90007759 100644 --- a/test/script/11_wrapper_emit_ir.c +++ b/test/script/11_wrapper_emit_ir.c @@ -13,6 +13,6 @@ int main(int argc, char** argv) { return 0; } -// CHECK: [Trace] Alloc 0x2 24 long double 16 1 +// CHECK: [Trace] Alloc 0x2 25 long double 16 1 // ir-out: source_filename = "{{.*}}11_wrapper_emit_ir.c" diff --git a/test/typemapping/01_simple_struct.c b/test/typemapping/01_simple_struct.c index 8946bcb7..e1c974b5 100644 --- a/test/typemapping/01_simple_struct.c +++ b/test/typemapping/01_simple_struct.c @@ -23,7 +23,7 @@ typedef struct s3_t { long b[2]; // 16 char c; // 32 unsigned int d[3]; // 36 - char e[5]; // 48 + char e[6]; // 48 unsigned long f; // 56 } s3; @@ -51,7 +51,7 @@ int main(int argc, char** argv) { // CHECK: extent: 4 // CHECK: member_count: 1 // CHECK: offsets: [ 0 ] -// CHECK: types: [ 12 ] +// CHECK: types: [ 13 ] // CHECK: sizes: [ 1 ] // CHECK: - id: 257 @@ -59,7 +59,7 @@ int main(int argc, char** argv) { // CHECK: extent: 16 // CHECK: member_count: 3 // CHECK: offsets: [ 0, 4, 8 ] -// CHECK: types: [ 12, {{(10|5)}}, 13 ] +// CHECK: types: [ 13, {{(11|6)}}, 14 ] // CHECK: sizes: [ 1, 1, 1 ] // CHECK: - id: 258 @@ -67,13 +67,13 @@ int main(int argc, char** argv) { // CHECK: extent: 64 // CHECK: member_count: 6 // CHECK: offsets: [ 0, 16, 32, 36, 48, 56 ] -// CHECK: types: [ 12, 13, {{(10|5)}}, {{(12|17)}}, {{(10|5)}}, {{(13|18)}} ] -// CHECK: sizes: [ 3, 2, 1, 3, 5, 1 ] +// CHECK: types: [ 13, 14, {{(11|6)}}, {{(13|18)}}, {{(11|6)}}, {{(14|19)}} ] +// CHECK: sizes: [ 3, 2, 1, 3, 6, 1 ] // CHECK: - id: 259 // CHECK: name: {{(struct.)?}}s4_t // CHECK: extent: 64 // CHECK: member_count: 4 // CHECK: offsets: [ 0, 8, 32, 56 ] -// CHECK: types: [ 12, 23, 23, 1 ] +// CHECK: types: [ 13, 24, 24, 1 ] // CHECK: sizes: [ 1, 3, 3, 1 ] diff --git a/test/typemapping/02_recursive_struct.c b/test/typemapping/02_recursive_struct.c index f95d9db3..7bc6c430 100644 --- a/test/typemapping/02_recursive_struct.c +++ b/test/typemapping/02_recursive_struct.c @@ -38,7 +38,7 @@ int main(int argc, char** argv) { // CHECK: extent: 16 // CHECK: member_count: 2 // CHECK: offsets: [ 0, 8 ] -// CHECK: types: [ {{(10|5)}}, 1 ] +// CHECK: types: [ {{(11|6)}}, 1 ] // CHECK: sizes: [ 3, 1 ] // CHECK: - id: 257 @@ -54,5 +54,5 @@ int main(int argc, char** argv) { // CHECK: extent: 64 // CHECK: member_count: 3 // CHECK: offsets: [ 0, 32, 40 ] -// CHECK: types: [ 256, {{(10|5)}}, 1 ] +// CHECK: types: [ 256, {{(11|6)}}, 1 ] // CHECK: sizes: [ 2, 1, 3 ] diff --git a/test/typemapping/04_milc_mock.c b/test/typemapping/04_milc_mock.c index f7a5f993..9c1c1f46 100644 --- a/test/typemapping/04_milc_mock.c +++ b/test/typemapping/04_milc_mock.c @@ -21,5 +21,5 @@ void foo() { // CHECK-NEXT: extent: 8 // CHECK-NEXT: member_count: 2 // CHECK-NEXT: offsets: [ 0, 4 ] -// CHECK-NEXT: types: [ 22, 22 ] +// CHECK-NEXT: types: [ 23, 23 ] // CHECK-NEXT: sizes: [ 1, 1 ] \ No newline at end of file diff --git a/test/typemapping/07_no_ebo_heap_multi_inheritance.cpp b/test/typemapping/07_no_ebo_heap_multi_inheritance.cpp new file mode 100644 index 00000000..f1f7e8bf --- /dev/null +++ b/test/typemapping/07_no_ebo_heap_multi_inheritance.cpp @@ -0,0 +1,40 @@ +// RUN: %remove %tu_yaml +// RUN: %cpp-to-llvm %s | %apply-typeart --typeart-stack=true +// RUN: cat %tu_yaml | %filecheck %s + +struct Base { + static double s_mem; + double s_mem_2; + static double s_mem_3; +}; + +struct BaseTwo { + double s_mem; +}; + +struct Derived : public Base, BaseTwo { + double pad; + int* c; +}; + +void foo() { + Derived d; +} + +// CHECK: name: {{(_ZTS7Derived|struct.Derived)}} +// CHECK-NEXT: extent: 32 +// CHECK-NEXT: member_count: 4 +// CHECK-NEXT: offsets: [ 0, 8, 16, 24 ] +// CHECK-NEXT: types: [ 25{{[6-9]}}, 25{{[6-9]}}, 24, 1 ] +// CHECK-NEXT: sizes: [ 1, 1, 1, 1 ] +// CHECK-NEXT: flags: 1 + +// 0 | struct Derived +// 0 | struct Base (base) +// 0 | double s_mem_2 +// 8 | struct BaseTwo (base) +// 8 | double s_mem +// 16 | double pad +// 24 | int * c +// | [sizeof=32, dsize=32, align=8, +// | nvsize=32, nvalign=8] diff --git a/test/typemapping/08_ebo_only_heap_multi_inheritance.cpp b/test/typemapping/08_ebo_only_heap_multi_inheritance.cpp new file mode 100644 index 00000000..9c9e8cea --- /dev/null +++ b/test/typemapping/08_ebo_only_heap_multi_inheritance.cpp @@ -0,0 +1,29 @@ +// RUN: %remove %tu_yaml +// RUN: %cpp-to-llvm %s | %apply-typeart --typeart-stack=true +// RUN: cat %tu_yaml | %filecheck %s + +struct Base { + static double s_mem; + static double s_mem_2; + static double s_mem_3; +}; + +struct BaseTwo { + static double other_s_mem; +}; + +struct Derived : public Base, BaseTwo { + double pad; + int* c; +}; + +void foo() { + Derived d; +} + +// CHECK: name: {{(_ZTS7Derived|struct.Derived)}} +// CHECK-NEXT: extent: 16 +// CHECK-NEXT: member_count: 2 +// CHECK-NEXT: offsets: [ 0, 8 ] +// CHECK-NEXT: types: [ 24, 1 ] +// CHECK-NEXT: sizes: [ 1, 1 ] diff --git a/test/typemapping/09_stack_class_inheritance_virtual.cpp b/test/typemapping/09_stack_class_inheritance_virtual.cpp new file mode 100644 index 00000000..4b0009c4 --- /dev/null +++ b/test/typemapping/09_stack_class_inheritance_virtual.cpp @@ -0,0 +1,54 @@ +// RUN: %remove %tu_yaml +// RUN: %cpp-to-llvm %s | %apply-typeart --typeart-stack=true +// RUN: cat %tu_yaml | %filecheck %s + +// REQUIRES: dimeta + +class Base { + public: + double x; + + virtual double foo() { + return x; + } +}; + +class X : public Base { + public: + int y; + char c; + unsigned char d; + + double foo() { + return y; + } +}; +int foo() { + X class_x; + return class_x.y; +} + +// CHECK: name: _ZTS1X +// CHECK-NEXT: extent: 24 +// CHECK-NEXT: member_count: 4 +// CHECK-NEXT: offsets: [ 0, 16, 20, 21 ] +// CHECK-NEXT: types: [ 25{{[0-9]}}, 13, 6, 7 ] +// CHECK-NEXT: sizes: [ 1, 1, 1, 1 ] +// CHECK-NEXT: flags: 1 + +// *** Dumping AST Record Layout +// 0 | class Base +// 0 | (Base vtable pointer) +// 8 | double x +// | [sizeof=16, dsize=16, align=8, +// | nvsize=16, nvalign=8] +// *** Dumping AST Record Layout +// 0 | class X +// 0 | class Base (primary base) +// 0 | (Base vtable pointer) +// 8 | double x +// 16 | int y +// 20 | char c +// 21 | unsigned char d +// | [sizeof=24, dsize=22, align=8, +// | nvsize=22, nvalign=8] diff --git a/test/typemapping/10_multi_inheritance_virtual.cpp b/test/typemapping/10_multi_inheritance_virtual.cpp new file mode 100644 index 00000000..1a303dac --- /dev/null +++ b/test/typemapping/10_multi_inheritance_virtual.cpp @@ -0,0 +1,57 @@ +// RUN: %remove %tu_yaml +// RUN: %cpp-to-llvm %s | %apply-typeart --typeart-stack=true +// RUN: cat %tu_yaml | %filecheck %s + +// REQUIRES: dimeta + +class Base { + public: + double x; + + virtual void foo(){}; +}; + +class X { + public: + int y; + + virtual int bar() { + return y; + }; +}; + +class Y : public X, public Base { + public: + float z; +}; + +void foo() { + Y class_y; +} + +// CHECK: name: _ZTS1X +// CHECK-NEXT: extent: 16 +// CHECK-NEXT: member_count: 2 +// CHECK-NEXT: offsets: [ 0, 8 ] +// CHECK-NEXT: types: [ 2, 13 ] +// CHECK-NEXT: sizes: [ 1, 1 ] +// CHECK-NEXT: flags: 1 + +// CHECK: name: _ZTS1Y +// CHECK-NEXT: extent: 40 +// CHECK-NEXT: member_count: 3 +// CHECK-NEXT: offsets: [ 0, 16, 32 ] +// CHECK-NEXT: types: [ 25{{[6-9]}}, 25{{[6-9]}}, 23 ] +// CHECK-NEXT: sizes: [ 1, 1, 1 ] +// CHECK-NEXT: flags: 1 + +// 0 | class Y +// 0 | class X (primary base) +// 0 | (X vtable pointer) +// 8 | int y +// 16 | class Base (base) +// 16 | (Base vtable pointer) +// 24 | double x +// 32 | float z +// | [sizeof=40, dsize=36, align=8, +// | nvsize=36, nvalign=8] diff --git a/test/typemapping/11_void_nullptr.cpp b/test/typemapping/11_void_nullptr.cpp new file mode 100644 index 00000000..1e3d6f30 --- /dev/null +++ b/test/typemapping/11_void_nullptr.cpp @@ -0,0 +1,32 @@ +// RUN: %remove %tu_yaml +// RUN: %cpp-to-llvm %s | %apply-typeart --typeart-stack=true +// RUN: cat %tu_yaml | %filecheck %s + +// REQUIRES: dimeta + +#include + +class Y { + public: + std::nullptr_t null_pointer; + void* void_pointer; + int* other_pointer; +}; + +void foo() { + Y class_y; +} + +// CHECK: name: _ZTS1Y +// CHECK-NEXT: extent: 24 +// CHECK-NEXT: member_count: 3 +// CHECK-NEXT: offsets: [ 0, 8, 16 ] +// CHECK-NEXT: types: [ 4, 3, 1 ] +// CHECK-NEXT: sizes: [ 1, 1, 1 ] + +// 0 | class Y +// 0 | std::nullptr_t null_pointer +// 8 | void * void_pointer +// 16 | int * other_pointer +// | [sizeof=24, dsize=24, align=8, +// | nvsize=24, nvalign=8] diff --git a/test/typemapping/12_complex.cpp b/test/typemapping/12_complex.cpp new file mode 100644 index 00000000..a3c93951 --- /dev/null +++ b/test/typemapping/12_complex.cpp @@ -0,0 +1,56 @@ +// RUN: %remove %tu_yaml +// RUN: %cpp-to-llvm %s | %apply-typeart --typeart-stack=true +// RUN: cat %tu_yaml | %filecheck %s + +// REQUIRES: dimeta + +#include + +class Y { + public: + std::complex f_cplx; + std::complex d_cplx; + std::complex ld_cplx; +}; + +void foo() { + Y class_y; +} + +// CHECK: name: _ZTSSt7complexIfE +// CHECK-NEXT: extent: 8 +// CHECK-NEXT: member_count: 1 +// CHECK-NEXT: offsets: [ 0 ] +// CHECK-NEXT: types: [ 26 ] +// CHECK-NEXT: sizes: [ 1 ] + +// CHECK: name: _ZTSSt7complexIdE +// CHECK-NEXT: extent: 16 +// CHECK-NEXT: member_count: 1 +// CHECK-NEXT: offsets: [ 0 ] +// CHECK-NEXT: types: [ 27 ] +// CHECK-NEXT: sizes: [ 1 ] + +// CHECK: name: _ZTSSt7complexIeE +// CHECK-NEXT: extent: 32 +// CHECK-NEXT: member_count: 1 +// CHECK-NEXT: offsets: [ 0 ] +// CHECK-NEXT: types: [ 28 ] +// CHECK-NEXT: sizes: [ 1 ] + +// CHECK: name: _ZTS1Y +// CHECK-NEXT: extent: 64 +// CHECK-NEXT: member_count: 3 +// CHECK-NEXT: offsets: [ 0, 8, 32 ] +// CHECK-NEXT: types: [ 25{{[0-9]}}, 25{{[0-9]}}, 25{{[0-9]}} ] +// CHECK-NEXT: sizes: [ 1, 1, 1 ] + +// 0 | class Y +// 0 | class std::complex f_cplx +// 0 | _ComplexT _M_value +// 8 | class std::complex d_cplx +// 8 | _ComplexT _M_value +// 32 | class std::complex ld_cplx +// 32 | _ComplexT _M_value +// | [sizeof=64, dsize=64, align=16, +// | nvsize=64, nvalign=16] diff --git a/test/typemapping/13_complex.c b/test/typemapping/13_complex.c new file mode 100644 index 00000000..532bbd52 --- /dev/null +++ b/test/typemapping/13_complex.c @@ -0,0 +1,24 @@ +// RUN: %remove %tu_yaml +// RUN: %c-to-llvm %s | %apply-typeart --typeart-stack=true +// RUN: cat %tu_yaml | %filecheck %s + +// REQUIRES: llvm-18 || llvm-19 + +#include + +typedef struct CplxY { + float complex f_cplx; + double complex d_cplx; + long double complex ld_cplx; +} Y; + +void foo() { + Y struct_y; +} + +// CHECK: name: {{(CplxY|struct.CplxY)}} +// CHECK-NEXT: extent: 64 +// CHECK-NEXT: member_count: 3 +// CHECK-NEXT: offsets: [ 0, 8, 32 ] +// CHECK-NEXT: types: [ 26, 27, 28 ] +// CHECK-NEXT: sizes: [ 1, 1, 1 ] diff --git a/test/typemapping/14_union.c b/test/typemapping/14_union.c new file mode 100644 index 00000000..4deb27de --- /dev/null +++ b/test/typemapping/14_union.c @@ -0,0 +1,19 @@ +// RUN: %remove %tu_yaml +// RUN: %c-to-llvm %s | %apply-typeart --typeart-stack=true +// RUN: cat %tu_yaml | %filecheck %s + +// REQUIRES: llvm-18 || llvm-19 + +union UnionTy { + float a; + int b; +}; + +void foo() { + union UnionTy union_stack; +} + +// CHECK: offsets: [ 0, 0 ] +// CHECK-NEXT: types: [ 23, 13 ] +// CHECK-NEXT: sizes: [ 1, 1 ] +// CHECK-NEXT: flags: 8