aboutsummaryrefslogtreecommitdiff
path: root/clang/test/CodeGen/lifetime.c
blob: 748a496a6e9ea55235debccc7a386f1f5671c81a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// RUN: %clang -S -emit-llvm -o - -O0 %s | FileCheck %s --implicit-check-not="call void @llvm.lifetime" -check-prefixes=CHECK
// RUN: %clang -S -emit-llvm -o - -O1 %s | FileCheck %s --implicit-check-not="call void @llvm.lifetime" -check-prefixes=CHECK,LIFETIME
// RUN: %clang -S -emit-llvm -o - -O2 %s | FileCheck %s --implicit-check-not="call void @llvm.lifetime" -check-prefixes=CHECK,LIFETIME
// RUN: %clang -S -emit-llvm -o - -O3 %s | FileCheck %s --implicit-check-not="call void @llvm.lifetime" -check-prefixes=CHECK,LIFETIME

extern void use(char *a);

// CHECK-LABEL: @helper_no_markers
__attribute__((always_inline)) void helper_no_markers(void) {
  char a;
  // LIFETIME: call void @llvm.lifetime.start.p0(i64 1,
  use(&a);
  // LIFETIME: call void @llvm.lifetime.end.p0(i64 1,
}

// CHECK-LABEL: @lifetime_test
void lifetime_test(void) {
// LIFETIME: call void @llvm.lifetime.start.p0(i64 1,
  helper_no_markers();
// LIFETIME: call void @llvm.lifetime.end.p0(i64 1,
}