|
| 1 | +/// Check that we generate fake uses only when -fextend-lifetimes is set and we |
| 2 | +/// are not setting optnone, or when we have optimizations set to -Og and we have |
| 3 | +/// not passed -fno-extend-lifetimes. |
| 4 | +// RUN: %clang_cc1 -emit-llvm -disable-llvm-passes -O0 -fextend-lifetimes %s -o - | FileCheck %s |
| 5 | +// RUN: %clang_cc1 -emit-llvm -disable-llvm-passes -O0 -disable-O0-optnone -fextend-lifetimes %s -o - | FileCheck %s --check-prefixes=CHECK,EXTEND |
| 6 | +// RUN: %clang_cc1 -emit-llvm -disable-llvm-passes -Og %s -o - | FileCheck %s --check-prefixes=CHECK,EXTEND |
| 7 | +// RUN: %clang_cc1 -emit-llvm -disable-llvm-passes -Og -fno-extend-lifetimes %s -o - | FileCheck %s |
| 8 | + |
| 9 | +/// Test various optimization flags with -fextend-lifetimes... |
| 10 | +// RUN: %clang_cc1 -emit-llvm -disable-llvm-passes -O1 %s -o - | FileCheck %s |
| 11 | +// RUN: %clang_cc1 -emit-llvm -disable-llvm-passes -O1 -fextend-lifetimes %s -o - | FileCheck %s --check-prefixes=CHECK,EXTEND |
| 12 | +// RUN: %clang_cc1 -emit-llvm -disable-llvm-passes -O2 %s -o - | FileCheck %s |
| 13 | +// RUN: %clang_cc1 -emit-llvm -disable-llvm-passes -O2 -fextend-lifetimes %s -o - | FileCheck %s --check-prefixes=CHECK,EXTEND |
| 14 | +// RUN: %clang_cc1 -emit-llvm -disable-llvm-passes -O3 %s -o - | FileCheck %s |
| 15 | +// RUN: %clang_cc1 -emit-llvm -disable-llvm-passes -O3 -fextend-lifetimes %s -o - | FileCheck %s --check-prefixes=CHECK,EXTEND |
| 16 | +// RUN: %clang_cc1 -emit-llvm -disable-llvm-passes -Os %s -o - | FileCheck %s |
| 17 | +// RUN: %clang_cc1 -emit-llvm -disable-llvm-passes -Os -fextend-lifetimes %s -o - | FileCheck %s --check-prefixes=CHECK,EXTEND |
| 18 | +// RUN: %clang_cc1 -emit-llvm -disable-llvm-passes -Oz %s -o - | FileCheck %s |
| 19 | +// RUN: %clang_cc1 -emit-llvm -disable-llvm-passes -Oz -fextend-lifetimes %s -o - | FileCheck %s --check-prefixes=CHECK,EXTEND |
| 20 | + |
| 21 | +// CHECK-LABEL: define{{.*}} void @_Z3fooi(i32{{.*}} %a) |
| 22 | +// CHECK-NEXT: entry: |
| 23 | +// CHECK-NEXT: %a.addr = alloca i32 |
| 24 | +// CHECK-NEXT: store i32 %a, ptr %a.addr |
| 25 | +// EXTEND-NEXT: %fake.use = load i32, ptr %a.addr |
| 26 | +// EXTEND-NEXT: call void (...) @llvm.fake.use(i32 %fake.use) |
| 27 | +// CHECK-NEXT: ret void |
| 28 | +// CHECK-NEXT: } |
| 29 | + |
| 30 | +void foo(int a) {} |
0 commit comments