44// RUN: %clang_cc1 -gkey-instructions -x c %s -debug-info-kind=line-tables-only -emit-llvm -o - \
55// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank
66
7- unsigned long long g , h ;
7+ unsigned long long g , h , i ;
88void fun () {
99// CHECK: store i64 0, ptr @g{{.*}}, !dbg [[G1R1:!.*]]
1010 g = 0 ;
@@ -37,13 +37,27 @@ void fun() {
3737
3838// Compound assignment with assignment on RHS, the assignments should have
3939// their own separate atom groups.
40- // CHECK: %4 = load i64, ptr @h{{.*}}, !dbg [[load_h_loc:!.*]]
41- // CHECK: %inc1 = add i64 %4, 1, !dbg [[G8R2:!.*]]
42- // CHECK: store i64 %inc1, ptr @h{{.*}}, !dbg [[G8R1:!.*]]
43- // CHECK: %5 = load i64, ptr @g{{.*}}, !dbg [[load_g_loc:!.*]]
44- // CHECK: %add2 = add i64 %5, %inc1, !dbg [[G7R2:!.*]]
45- // CHECK: store i64 %add2, ptr @g{{.*}}, !dbg [[G7R1:!.*]]
40+ // CHECK-NEXT : %4 = load i64, ptr @h{{.*}}, !dbg [[load_h_loc:!.*]]
41+ // CHECK-NEXT : %inc1 = add i64 %4, 1, !dbg [[G8R2:!.*]]
42+ // CHECK-NEXT : store i64 %inc1, ptr @h{{.*}}, !dbg [[G8R1:!.*]]
43+ // CHECK-NEXT : %5 = load i64, ptr @g{{.*}}, !dbg [[load_g_loc:!.*]]
44+ // CHECK-NEXT : %add2 = add i64 %5, %inc1, !dbg [[G7R2:!.*]]
45+ // CHECK-NEXT : store i64 %add2, ptr @g{{.*}}, !dbg [[G7R1:!.*]]
4646 g += ++ h ;
47+
48+ // Double check the comma operator doesn't disturb atom groupings. There
49+ // are three assignments, so we should get three groups.
50+ // FIXME: Same situation as earlier in the test - because of the atomGroup
51+ // implementation the load (from h) can only be associated with one of the two
52+ // stores (to h and g) despite being a good backup location for both.
53+ // CHECK-NEXT: %6 = load i64, ptr @h{{.*}}, !dbg [[load_h_loc2:!.*]]
54+ // CHECK-NEXT: %inc3 = add i64 %6, 1, !dbg [[G9R2:!.*]]
55+ // CHECK-NEXT: store i64 %inc3, ptr @h{{.*}}, !dbg [[G10R1:!.*]]
56+ // CHECK-NEXT: store i64 %inc3, ptr @g{{.*}}, !dbg [[G9R1:!.*]]
57+ // CHECK-NEXT: %7 = load i64, ptr @i{{.*}}, !dbg [[load_i_loc:!.*]]
58+ // CHECK-NEXT: %inc4 = add i64 %7, 1, !dbg [[G11R2:!.*]]
59+ // CHECK-NEXT: store i64 %inc4, ptr @i{{.*}}, !dbg [[G11R1:!.*]]
60+ g = ++ h , ++ i ;
4761}
4862
4963// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
@@ -62,3 +76,10 @@ void fun() {
6276// CHECK: [[load_g_loc]] = !DILocation(line: [[#]], column: [[#]], scope: ![[#]])
6377// CHECK: [[G7R2]] = !DILocation({{.*}}, atomGroup: 7, atomRank: 2)
6478// CHECK: [[G7R1]] = !DILocation({{.*}}, atomGroup: 7, atomRank: 1)
79+ // CHECK: [[load_h_loc2]] = !DILocation(line: [[#]], column: [[#]], scope: ![[#]])
80+ // CHECK: [[G9R2]] = !DILocation({{.*}}, atomGroup: 9, atomRank: 2)
81+ // CHECK: [[G10R1]] = !DILocation({{.*}}, atomGroup: 10, atomRank: 1)
82+ // CHECK: [[G9R1]] = !DILocation({{.*}}, atomGroup: 9, atomRank: 1)
83+ // CHECK: [[load_i_loc]] = !DILocation(line: [[#]], column: [[#]], scope: ![[#]])
84+ // CHECK: [[G11R2]] = !DILocation({{.*}}, atomGroup: 11, atomRank: 2)
85+ // CHECK: [[G11R1]] = !DILocation({{.*}}, atomGroup: 11, atomRank: 1)
0 commit comments