1 // RUN: %clang -w -target x86_64-linux-gnu -S -emit-llvm -o - -fno-exceptions -O0 \
2 // RUN: -Xclang -disable-llvm-passes %s | FileCheck %s -check-prefixes=CHECK \
3 // RUN: --implicit-check-not=llvm.lifetime
4 // RUN: %clang -w -target x86_64-linux-gnu -S -emit-llvm -o - -fno-exceptions -O0 \
5 // RUN: -fsanitize=address -fsanitize-address-use-after-scope \
6 // RUN: -Xclang -disable-llvm-passes %s | FileCheck %s -check-prefixes=CHECK,LIFETIME
7 // RUN: %clang -w -target x86_64-linux-gnu -S -emit-llvm -o - -fno-exceptions -O0 \
8 // RUN: -fsanitize=memory -Xclang -disable-llvm-passes %s | \
9 // RUN: FileCheck %s -check-prefixes=CHECK,LIFETIME
10 // RUN: %clang -w -target aarch64-linux-gnu -S -emit-llvm -o - -fno-exceptions -O0 \
11 // RUN: -fsanitize=hwaddress -Xclang -disable-llvm-passes %s | \
12 // RUN: FileCheck %s -check-prefixes=CHECK,LIFETIME
14 extern int bar(char *A
, int n
);
26 extern "C" void a(), b(), c(), d();
28 // CHECK: define dso_local void @_Z3fooi(i32 noundef %[[N:[^)]+]])
30 // CHECK: store i32 %[[N]], ptr %[[NADDR:[^,]+]]
31 // CHECK-LABEL: call void @a()
34 // CHECK-LABEL: call void @b()
35 // CHECK: [[NARG:%[^ ]+]] = load i32, ptr %[[NADDR]]
36 // CHECK: [[BOOL:%[^ ]+]] = icmp ne i32 [[NARG]], 0
37 // CHECK: store i1 false
38 // CHECK: br i1 [[BOOL]], label %[[ONTRUE:[^,]+]], label %[[ONFALSE:[^,]+]]
41 // LIFETIME: @llvm.lifetime.start
42 // LIFETIME: store i1 true
43 // LIFETIME: call void @_ZN1XC
44 // CHECK: br label %[[END:[^,]+]]
46 // CHECK: [[ONFALSE]]:
47 // LIFETIME: @llvm.lifetime.start
48 // LIFETIME: store i1 true
49 // LIFETIME: call void @_ZN1YC
50 // CHECK: br label %[[END]]
53 // CHECK: call void @c()
54 // LIFETIME: @llvm.lifetime.end
55 // LIFETIME: @llvm.lifetime.end
56 b(), (n
? X().p
: Y().p
), c();
58 // CHECK: call void @d()