| 1 |
// RUN: %clang_cc1 -triple x86_64-linux-gnu -gkey-instructions -x c++ -std=c++17 %s -debug-info-kind=line-tables-only -emit-llvm -o - \ |
| 2 |
// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank --check-prefixes=CHECK,CHECK-CXX |
| 3 |
|
| 4 |
// RUN: %clang_cc1 -triple x86_64-linux-gnu -gkey-instructions -x c %s -debug-info-kind=line-tables-only -emit-llvm -o - \ |
| 5 |
// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank --check-prefixes=CHECK,CHECK-C |
| 6 |
|
| 7 |
int g; |
| 8 |
void a(int A, int B) { |
| 9 |
// CHECK: entry: |
| 10 |
// The load gets associated with the branch rather than the store. |
| 11 |
// TODO: Associating it with the store may be a better choice. |
| 12 |
// CHECK: %0 = load i32, ptr %A.addr{{.*}}, !dbg [[G2R2:!.*]] |
| 13 |
// CHECK: store i32 %0, ptr @g{{.*}}, !dbg [[G1R1:!.*]] |
| 14 |
// CHECK: switch i32 %0, label %{{.*}} [ |
| 15 |
// CHECK: i32 0, label %sw.bb |
| 16 |
// CHECK: i32 1, label %sw.bb1 |
| 17 |
// CHECK: ], !dbg [[G2R1:!.*]] |
| 18 |
switch ((g = A)) { |
| 19 |
// CHECK: br label %sw.epilog[[#]], !dbg [[G3R1:!.*]] |
| 20 |
case 0: break; |
| 21 |
case 1: { |
| 22 |
// CHECK: sw.bb1: |
| 23 |
// CHECK: %1 = load i32, ptr %B.addr{{.*}}, !dbg [[G4R2:!.*]] |
| 24 |
// CHECK: switch i32 %1, label %{{.*}} [ |
| 25 |
// CHECK: i32 0, label %sw.bb2 |
| 26 |
// CHECK: ], !dbg [[G4R1:!.*]] |
| 27 |
switch ((B)) { |
| 28 |
case 0: { |
| 29 |
// Test that assignments in constant-folded switches don't go missing. |
| 30 |
// CHECK-CXX: sw.bb2: |
| 31 |
// CHECK-CXX: store i32 1, ptr %C{{.*}}, !dbg [[G5R1:!.*]] |
| 32 |
#ifdef __cplusplus |
| 33 |
switch (const int C = 1; C) { |
| 34 |
case 0: break; |
| 35 |
case 1: break; |
| 36 |
default: break; |
| 37 |
} |
| 38 |
#endif |
| 39 |
}; |
| 40 |
} |
| 41 |
}; |
| 42 |
} |
| 43 |
// CHECK: ret{{.*}}, !dbg [[RET:!.*]] |
| 44 |
} |
| 45 |
|
| 46 |
// CHECK: [[G2R2]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 2) |
| 47 |
// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1) |
| 48 |
// CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1) |
| 49 |
// CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1) |
| 50 |
// CHECK: [[G4R2]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 2) |
| 51 |
// CHECK: [[G4R1]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 1) |
| 52 |
// CHECK-CXX: [[G5R1]] = !DILocation({{.*}}, atomGroup: 5, atomRank: 1) |
| 53 |
// CHECK-CXX: [[RET]] = !DILocation({{.*}}, atomGroup: 6, atomRank: 1) |
| 54 |
// CHECK-C: [[RET]] = !DILocation({{.*}}, atomGroup: 5, atomRank: 1) |