Debian Codegraph @

clang/test/DebugInfo/KeyInstructions/while.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 // We've made the cmp and br separate source atoms for now, to match existing
11 // behaviour in this case:
12 // 1. while (
13 // 2. int i = --End
14 // 3. ) {
15 // 4. useValue(i);
16 // 5. }
17 // Without Key Instructions we go: 2, 1[, 4, 2, 1]+
18 // Without separating cmp and br with Key Instructions we'd get:
19 // 1[, 4, 1]+. If we made the cmp higher precedence than the
20 // br and had them in the same group, we could get:
21 // 2, [4, 2]+ which might be nicer. FIXME: do that later.
22
23 void a(int A) {
24 // CHECK: %dec = add nsw i32 %0, -1, !dbg [[G1R2:!.*]]
25 // CHECK: store i32 %dec, ptr %A.addr{{.*}}, !dbg [[G1R1:!.*]]
26 // CHECK: %tobool = icmp ne i32 %dec, 0, !dbg [[G2R1:!.*]]
27 // CHECK: br i1 %tobool, label %while.body, label %while.end, !dbg [[G3R1:!.*]]
28 while (--A) { };
29
30 // CHECK: ret{{.*}}, !dbg [[RET:!.*]]
31 }
32
33 // CHECK: [[G1R2]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 2)
34 // CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
35 // CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)
36 // CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)
37 // CHECK: [[RET]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 1)