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