88 lines · c
1// RUN: %clang_cc1 -triple x86_64-linux-gnu -gkey-instructions -x c++ %s -debug-info-kind=line-tables-only -emit-llvm -o - \2// RUN: | FileCheck %s --implicit-check-not atomGroup --implicit-check-not atomRank3 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 atomRank6 7unsigned long long g, h, i;8void fun() {9// CHECK: store i64 0, ptr @g{{.*}}, !dbg [[G1R1:!.*]]10 g = 0;11 12// Treat the two assignments as two atoms.13//14// FIXME: Because of the atomGroup implementation the load can only be15// associated with one of the two stores, despite being a good backup16// loction for both.17// CHECK-NEXT: %0 = load i64, ptr @g{{.*}}, !dbg [[G2R2:!.*]]18// CHECK-NEXT: store i64 %0, ptr @g{{.*}}, !dbg [[G3R1:!.*]]19// CHECK-NEXT: store i64 %0, ptr @g{{.*}}, !dbg [[G2R1:!.*]]20 g = g = g;21 22// Compound assignment.23// CHECK: %1 = load i64, ptr @g24// CHECK: %add = add i64 %1, 50, !dbg [[G4R2:!.*]]25// CHECK: store i64 %add, ptr @g{{.*}}, !dbg [[G4R1:!.*]]26 g += 50;27 28// Pre/Post Inc/Dec.29// CHECK: %2 = load i64, ptr @g30// CHECK: %inc = add i64 %2, 1, !dbg [[G5R2:!.*]]31// CHECK: store i64 %inc, ptr @g{{.*}}, !dbg [[G5R1:!.*]]32 ++g;33// CHECK: %3 = load i64, ptr @g34// CHECK: %dec = add i64 %3, -1, !dbg [[G6R2:!.*]]35// CHECK: store i64 %dec, ptr @g{{.*}}, !dbg [[G6R1:!.*]]36 g--;37 38// Compound assignment with assignment on RHS, the assignments should have39// their own separate atom groups.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:!.*]]46 g += ++h;47 48// Double check the comma operator doesn't disturb atom groupings. There49// are three assignments, so we should get three groups.50// FIXME: Same situation as earlier in the test - because of the atomGroup51// implementation the load (from h) can only be associated with one of the two52// 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;61// CHECK: ret{{.*}}, !dbg [[RET:!.*]]62}63 64// CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)65// CHECK: [[G2R2]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 2)66// CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)67// CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)68// CHECK: [[G4R2]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 2)69// CHECK: [[G4R1]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 1)70// CHECK: [[G5R2]] = !DILocation({{.*}}, atomGroup: 5, atomRank: 2)71// CHECK: [[G5R1]] = !DILocation({{.*}}, atomGroup: 5, atomRank: 1)72// CHECK: [[G6R2]] = !DILocation({{.*}}, atomGroup: 6, atomRank: 2)73// CHECK: [[G6R1]] = !DILocation({{.*}}, atomGroup: 6, atomRank: 1)74// CHECK: [[load_h_loc]] = !DILocation(line: [[#]], column: [[#]], scope: ![[#]])75// CHECK: [[G8R2]] = !DILocation({{.*}}, atomGroup: 8, atomRank: 2)76// CHECK: [[G8R1]] = !DILocation({{.*}}, atomGroup: 8, atomRank: 1)77// CHECK: [[load_g_loc]] = !DILocation(line: [[#]], column: [[#]], scope: ![[#]])78// CHECK: [[G7R2]] = !DILocation({{.*}}, atomGroup: 7, atomRank: 2)79// CHECK: [[G7R1]] = !DILocation({{.*}}, atomGroup: 7, atomRank: 1)80// CHECK: [[load_h_loc2]] = !DILocation(line: [[#]], column: [[#]], scope: ![[#]])81// CHECK: [[G9R2]] = !DILocation({{.*}}, atomGroup: 9, atomRank: 2)82// CHECK: [[G10R1]] = !DILocation({{.*}}, atomGroup: 10, atomRank: 1)83// CHECK: [[G9R1]] = !DILocation({{.*}}, atomGroup: 9, atomRank: 1)84// CHECK: [[load_i_loc]] = !DILocation(line: [[#]], column: [[#]], scope: ![[#]])85// CHECK: [[G11R2]] = !DILocation({{.*}}, atomGroup: 11, atomRank: 2)86// CHECK: [[G11R1]] = !DILocation({{.*}}, atomGroup: 11, atomRank: 1)87// CHECK: [[RET]] = !DILocation({{.*}}, atomGroup: 12, atomRank: 1)88