brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 225d5e2 Raw
64 lines · cpp
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.lifetime4// 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,LIFETIME7// RUN: %clang -w -target x86_64-linux-gnu -S -emit-llvm -o - -fno-exceptions -O0 \8// RUN:     -fsanitize=kernel-address -fsanitize-address-use-after-scope \9// RUN:     -Xclang -disable-llvm-passes %s | FileCheck %s -check-prefixes=CHECK,LIFETIME10// RUN: %clang -w -target x86_64-linux-gnu -S -emit-llvm -o - -fno-exceptions -O0 \11// RUN:     -fsanitize=memory -Xclang -disable-llvm-passes %s | \12// RUN:     FileCheck %s -check-prefixes=CHECK,LIFETIME13// RUN: %clang -w -target aarch64-linux-gnu -S -emit-llvm -o - -fno-exceptions -O0 \14// RUN:     -fsanitize=hwaddress -Xclang -disable-llvm-passes %s | \15// RUN:     FileCheck %s -check-prefixes=CHECK,LIFETIME16 17extern int bar(char *A, int n);18 19struct X {20  X();21  ~X();22  int *p;23};24struct Y {25  Y();26  int *p;27};28 29extern "C" void a(), b(), c(), d();30 31// CHECK: define dso_local void @_Z3fooi(i32 noundef %[[N:[^)]+]])32void foo(int n) {33  // CHECK: store i32 %[[N]], ptr %[[NADDR:[^,]+]]34  // CHECK-LABEL: call void @a()35  a();36 37  // CHECK-LABEL: call void @b()38  // CHECK: [[NARG:%[^ ]+]] = load i32, ptr %[[NADDR]]39  // CHECK: [[BOOL:%[^ ]+]] = icmp ne i32 [[NARG]], 040  // CHECK: store i1 false41  // CHECK: br i1 [[BOOL]], label %[[ONTRUE:[^,]+]], label %[[ONFALSE:[^,]+]]42  //43  // CHECK: [[ONTRUE]]:44  // LIFETIME: @llvm.lifetime.start45  // LIFETIME: store i1 true46  // LIFETIME: call void @_ZN1XC47  // CHECK: br label %[[END:[^,]+]]48  //49  // CHECK: [[ONFALSE]]:50  // LIFETIME: @llvm.lifetime.start51  // LIFETIME: store i1 true52  // LIFETIME: call void @_ZN1YC53  // CHECK: br label %[[END]]54  //55  // CHECK: [[END]]:56  // CHECK: call void @c()57  // LIFETIME: @llvm.lifetime.end58  // LIFETIME: @llvm.lifetime.end59  b(), (n ? X().p : Y().p), c();60 61  // CHECK: call void @d()62  d();63}64