1*67e74705SXin Li // RUN: %clang_cc1 -O1 -triple x86_64-none-linux-gnu -emit-llvm -debug-info-kind=line-tables-only %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=LIFETIME
2*67e74705SXin Li
3*67e74705SXin Li // We shouldn't have markers at -O0 or with msan.
4*67e74705SXin Li // RUN: %clang_cc1 -O0 -triple x86_64-none-linux-gnu -emit-llvm -debug-info-kind=line-tables-only %s -o - | FileCheck %s
5*67e74705SXin Li // RUN: %clang_cc1 -O1 -triple x86_64-none-linux-gnu -emit-llvm -debug-info-kind=line-tables-only %s -o - -fsanitize=memory | FileCheck %s
6*67e74705SXin Li
7*67e74705SXin Li // There is no exception to handle here, lifetime.end is not a destructor,
8*67e74705SXin Li // so there is no need have cleanup dest slot related code
9*67e74705SXin Li // CHECK-LABEL: define i32 @test
test()10*67e74705SXin Li int test() {
11*67e74705SXin Li int x = 3;
12*67e74705SXin Li int *volatile p = &x;
13*67e74705SXin Li return *p;
14*67e74705SXin Li // CHECK: [[X:%.*]] = alloca i32
15*67e74705SXin Li // CHECK: [[P:%.*]] = alloca i32*
16*67e74705SXin Li // LIFETIME: call void @llvm.lifetime.start(i64 4, i8* %{{.*}}){{( #[0-9]+)?}}, !dbg
17*67e74705SXin Li // LIFETIME: call void @llvm.lifetime.start(i64 8, i8* %{{.*}}){{( #[0-9]+)?}}, !dbg
18*67e74705SXin Li // CHECK-NOT: store i32 %{{.*}}, i32* %cleanup.dest.slot
19*67e74705SXin Li // LIFETIME: call void @llvm.lifetime.end(i64 8, {{.*}}){{( #[0-9]+)?}}, !dbg
20*67e74705SXin Li // LIFETIME: call void @llvm.lifetime.end(i64 4, {{.*}}){{( #[0-9]+)?}}, !dbg
21*67e74705SXin Li }
22