diff options
Diffstat (limited to 'test/CodeGen/cleanup-destslot-simple.c')
-rw-r--r-- | test/CodeGen/cleanup-destslot-simple.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/CodeGen/cleanup-destslot-simple.c b/test/CodeGen/cleanup-destslot-simple.c new file mode 100644 index 000000000000..bae97c81cbba --- /dev/null +++ b/test/CodeGen/cleanup-destslot-simple.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -O1 -triple x86_64-none-linux-gnu -emit-llvm -gline-tables-only %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=LIFETIME + +// We shouldn't have markers at -O0 or with msan. +// RUN: %clang_cc1 -O0 -triple x86_64-none-linux-gnu -emit-llvm -gline-tables-only %s -o - | FileCheck %s --check-prefix=CHECK +// RUN: %clang_cc1 -O1 -triple x86_64-none-linux-gnu -emit-llvm -gline-tables-only %s -o - -fsanitize=memory | FileCheck %s --check-prefix=CHECK + +// There is no exception to handle here, lifetime.end is not a destructor, +// so there is no need have cleanup dest slot related code +// CHECK-LABEL: define i32 @test +int test() { + int x = 3; + int *volatile p = &x; + return *p; +// CHECK: [[X:%.*]] = alloca i32 +// CHECK: [[P:%.*]] = alloca i32* +// LIFETIME: call void @llvm.lifetime.start(i64 4, i8* %{{.*}}) +// LIFETIME: call void @llvm.lifetime.start(i64 8, i8* %{{.*}}) +// CHECK-NOT: store i32 %{{.*}}, i32* %cleanup.dest.slot +} |