|
| 1 | +// RUN: %clang -gkey-instructions -x c++ -std=c++17 %s -gmlt -S -emit-llvm -o - \ |
| 2 | +// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank --check-prefixes=CHECK,CHECK-CXX |
| 3 | + |
| 4 | +// RUN: %clang -gkey-instructions -x c %s -gmlt -S -emit-llvm -o - \ |
| 5 | +// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank |
| 6 | + |
| 7 | +int g; |
| 8 | +void a(int A) { |
| 9 | +// The branch is a key instruction, with the condition being its backup. |
| 10 | +// CHECK: entry: |
| 11 | +// CHECK: %tobool = icmp ne i32 %0, 0{{.*}}, !dbg [[G1R2:!.*]] |
| 12 | +// CHECK: br i1 %tobool, label %if.then, label %if.end{{.*}}, !dbg [[G1R1:!.*]] |
| 13 | + if (A) |
| 14 | + ; |
| 15 | + |
| 16 | +// The assignment in the if gets a distinct source atom group. |
| 17 | +// CHECK: if.end: |
| 18 | +// CHECK: %1 = load i32, ptr %A.addr{{.*}}, !dbg [[G2R2:!.*]] |
| 19 | +// CHECK: store i32 %1, ptr @g{{.*}}, !dbg [[G2R1:!.*]] |
| 20 | +// CHECK: %tobool1 = icmp ne i32 %1, 0{{.*}}, !dbg [[G3R2:!.*]] |
| 21 | +// CHECK: br i1 %tobool1, label %if.then2, label %if.end3{{.*}}, !dbg [[G3R1:!.*]] |
| 22 | + if ((g = A)) |
| 23 | + ; |
| 24 | + |
| 25 | +#ifdef __cplusplus |
| 26 | +// The assignment in the if gets a distinct source atom group. |
| 27 | +// CHECK-CXX: if.end3: |
| 28 | +// CHECK-CXX: %2 = load i32, ptr %A.addr{{.*}}, !dbg [[G4R2:!.*]] |
| 29 | +// CHECK-CXX: store i32 %2, ptr %B{{.*}}, !dbg [[G4R1:!.*]] |
| 30 | +// CHECK-CXX: %tobool4 = icmp ne i32 %3, 0{{.*}}, !dbg [[G5R2:!.*]] |
| 31 | +// CHECK-CXX: br i1 %tobool4, label %if.then5, label %if.end6{{.*}}, !dbg [[G5R1:!.*]] |
| 32 | + if (int B = A; B) |
| 33 | + ; |
| 34 | +#endif |
| 35 | +} |
| 36 | + |
| 37 | +// CHECK: [[G1R2]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 2) |
| 38 | +// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1) |
| 39 | +// CHECK: [[G2R2]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 2) |
| 40 | +// CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1) |
| 41 | +// CHECK: [[G3R2]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 2) |
| 42 | +// CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1) |
| 43 | +// CHECK-CXX: [[G4R2]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 2) |
| 44 | +// CHECK-CXX: [[G4R1]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 1) |
| 45 | +// CHECK-CXX: [[G5R2]] = !DILocation({{.*}}, atomGroup: 5, atomRank: 2) |
| 46 | +// CHECK-CXX: [[G5R1]] = !DILocation({{.*}}, atomGroup: 5, atomRank: 1) |
0 commit comments