Debian Codegraph @

clang/test/DebugInfo/KeyInstructions/do.c

raw
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
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
6
7 // Perennial question: should the `dec` be in its own source atom or not
8 // (currently it is).
9
10 // Another question - we've made the cmp and br separate source atoms for
11 // now, to match existing behaviour in this case:
12 // 1. do {
13 // 2. something();
14 // 3. }
15 // 4. while (--A);
16 // Non key instruction behaviour is: 2, 4[, 3, 2, 4]+
17 // The cond br is associated with the brace on line 3 and the cmp is line 4;
18 // if they were in the same atom group we'd step just: 2, 3[, 2, 3]+
19 // FIXME: We could arguably improve the behaviour by making them the same
20 // group but having the cmp higher precedence, resulting in: 2, 4[, 2, 4]+.
21
22 void a(int A) {
23 // CHECK: %dec = add nsw i32 %0, -1, !dbg [[G1R2:!.*]]
24 // CHECK: store i32 %dec, ptr %A.addr{{.*}}, !dbg [[G1R1:!.*]]
25 // CHECK: %tobool = icmp ne i32 %dec, 0, !dbg [[G2R1:!.*]]
26 // CHECK: br i1 %tobool, label %do.body, label %do.end, !dbg [[G3R1:!.*]], !llvm.loop
27 do { } while (--A);
28
29 // CHECK: ret{{.*}}, !dbg [[RET:!.*]]
30 }
31
32 // CHECK: [[G1R2]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 2)
33 // CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
34 // CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)
35 // CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)
36 // CHECK: [[RET]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 1)