| 1 |
// RUN: %clang -### -target x86_64 -c -gdwarf -gkey-instructions %s 2>&1 | FileCheck %s --check-prefixes=KEY-INSTRUCTIONS |
| 2 |
// RUN: %clang -### -target x86_64 -c -gdwarf -gno-key-instructions %s 2>&1 | FileCheck %s --check-prefixes=NO-KEY-INSTRUCTIONS |
| 3 |
// RUN: %clang -### -target x86_64 -c -gno-key-instructions %s 2>&1 | FileCheck %s --check-prefixes=NO-DEBUG |
| 4 |
|
| 5 |
//// Help. |
| 6 |
// RUN %clang --help | FileCheck %s --check-prefix=HELP |
| 7 |
// HELP: -gkey-instructions Enable Key Instructions, which reduces the jumpiness of debug stepping in optimized C/C++ code in some debuggers. DWARF only. |
| 8 |
|
| 9 |
// KEY-INSTRUCTIONS: "-gkey-instructions" |
| 10 |
// NO-KEY-INSTRUCTIONS-NOT: key-instructions |
| 11 |
|
| 12 |
// Only expect one dwarf related flag. |
| 13 |
// NO-DEBUG: -fdwarf2-cfi-asm |
| 14 |
// NO-DEBUG-NOT: debug-info-kind |
| 15 |
// NO-DEBUG-NOT: dwarf |
| 16 |
|
| 17 |
//// Help hidden: flag should not be visible. |
| 18 |
// RUN: %clang --help | FileCheck %s --check-prefix=HELP |
| 19 |
// HELP-NOT: key-instructions |
| 20 |
|
| 21 |
// Smoke test: check for Key Instructions keywords in the IR. |
| 22 |
void f() {} |
| 23 |
// RUN: %clang_cc1 %s -triple x86_64-linux-gnu -debug-info-kind=line-tables-only -emit-llvm -o - | FileCheck %s --check-prefix=SMOKETEST-OFF |
| 24 |
// SMOKETEST-OFF-NOT: keyInstructions: |
| 25 |
// SMOKETEST-OFF-NOT: atomGroup |
| 26 |
|
| 27 |
// RUN: %clang_cc1 %s -triple x86_64-linux-gnu -gkey-instructions -debug-info-kind=line-tables-only -emit-llvm -o - | FileCheck %s --check-prefix=SMOKETEST-ON |
| 28 |
// SMOKETEST-ON: keyInstructions: true |
| 29 |
// SMOKETEST-ON: atomGroup: 1 |
| 30 |
|
| 31 |
//// Enable Key Instructions by default if optimisations are enabled and we're |
| 32 |
//// emitting DWARF. |
| 33 |
//// |
| 34 |
//// | opt level | -gkey-instructions | feature | |
| 35 |
//// | 0 | no | off | |
| 36 |
//// | 0 | yes | on | |
| 37 |
//// | >=1 | no | on | |
| 38 |
//// | >=1 | yes | on | |
| 39 |
//// | >=1 | no & no -g flags | off | |
| 40 |
//// | >=1 | no & emit codeview | off | |
| 41 |
// |
| 42 |
// RUN: %clang %s -target x86_64 -gdwarf -gmlt -### 2>&1 | FileCheck %s --check-prefix=NO-KEY-INSTRUCTIONS |
| 43 |
// RUN: %clang %s -target x86_64 -gdwarf -gmlt -gkey-instructions -### 2>&1 | FileCheck %s --check-prefix=KEY-INSTRUCTIONS |
| 44 |
// RUN: %clang %s -O0 -target x86_64 -gdwarf -gmlt -### 2>&1 | FileCheck %s --check-prefix=NO-KEY-INSTRUCTIONS |
| 45 |
// RUN: %clang %s -O0 -target x86_64 -gdwarf -gmlt -gkey-instructions -### 2>&1 | FileCheck %s --check-prefix=KEY-INSTRUCTIONS |
| 46 |
// RUN: %clang %s -O1 -target x86_64 -gdwarf -gmlt -### 2>&1 | FileCheck %s --check-prefix=KEY-INSTRUCTIONS |
| 47 |
// RUN: %clang %s -O1 -target x86_64 -gdwarf -gmlt -gkey-instructions -### 2>&1 | FileCheck %s --check-prefix=KEY-INSTRUCTIONS |
| 48 |
// RUN: %clang %s -O1 -target x86_64 -### 2>&1 | FileCheck %s --check-prefixes=NO-KEY-INSTRUCTIONS |
| 49 |
// RUN: %clang %s -O1 -target x86_64 -gcodeview -gmlt -### 2>&1 | FileCheck %s --check-prefixes=NO-KEY-INSTRUCTIONS |
| 50 |
// |
| 51 |
// RUN: %clang %s -target x86_64 -gdwarf -gmlt -S -emit-llvm -o - | FileCheck %s --check-prefix=SMOKETEST-OFF |
| 52 |
// RUN: %clang %s -target x86_64 -gdwarf -gmlt -gkey-instructions -S -emit-llvm -o - | FileCheck %s --check-prefix=SMOKETEST-ON |
| 53 |
// RUN: %clang %s -O0 -target x86_64 -gdwarf -gmlt -S -emit-llvm -o - | FileCheck %s --check-prefix=SMOKETEST-OFF |
| 54 |
// RUN: %clang %s -O0 -target x86_64 -gdwarf -gmlt -gkey-instructions -S -emit-llvm -o - | FileCheck %s --check-prefix=SMOKETEST-ON |
| 55 |
// RUN: %clang %s -O1 -target x86_64 -gdwarf -gmlt -S -emit-llvm -o - | FileCheck %s --check-prefix=SMOKETEST-ON |
| 56 |
// RUN: %clang %s -O1 -target x86_64 -gdwarf -gmlt -gkey-instructions -S -emit-llvm -o - | FileCheck %s --check-prefix=SMOKETEST-ON |
| 57 |
// RUN: %clang %s -O1 -target x86_64 -S -emit-llvm -o - | FileCheck %s --check-prefixes=SMOKETEST-OFF,SMOKETEST-NO-DEBUG |
| 58 |
// RUN: %clang %s -O1 -target x86_64 -gcodeview -gmlt -S -emit-llvm -o - | FileCheck %s --check-prefixes=SMOKETEST-OFF |
| 59 |
// SMOKETEST-NO-DEBUG: llvm.module.flags |
| 60 |
// SMOKETEST-NO-DEBUG-NOT: DICompileUnit |
| 61 |
|
| 62 |
//// Check only "plain" C/C++ turns on Key Instructions by default. |
| 63 |
// RUN: %clang -x c %s -O1 -target x86_64 -gdwarf -gmlt -### 2>&1 | FileCheck %s --check-prefix=KEY-INSTRUCTIONS |
| 64 |
// RUN: %clang -x c++ %s -O1 -target x86_64 -gdwarf -gmlt -### 2>&1 | FileCheck %s --check-prefix=KEY-INSTRUCTIONS |
| 65 |
// RUN: %clang -x cuda -nocudalib -nocudainc %s -O1 -target x86_64 -gdwarf -gmlt -### 2>&1 | FileCheck %s --check-prefix=NO-KEY-INSTRUCTIONS |
| 66 |
// RUN: %clang -x hip -nogpulib -nogpuinc %s -O1 -target x86_64 -gdwarf -gmlt -### 2>&1 | FileCheck %s --check-prefix=NO-KEY-INSTRUCTIONS |
| 67 |
// RUN: %clang -x cl %s -O1 -target x86_64 -gdwarf -gmlt -### 2>&1 | FileCheck %s --check-prefix=NO-KEY-INSTRUCTIONS |
| 68 |
// RUN: %clang -x objective-c %s -O1 -target x86_64 -gdwarf -gmlt -### 2>&1 | FileCheck %s --check-prefix=NO-KEY-INSTRUCTIONS |
| 69 |
// RUN: %clang -x objective-c++ %s -O1 -target x86_64 -gdwarf -gmlt -### 2>&1 | FileCheck %s --check-prefix=NO-KEY-INSTRUCTIONS |