1- // RUN: %clang_cc1 -gkey-instructions -gno-column-info -x c++ %s -debug-info-kind=line-tables-only -emit-llvm -o - \
1+ // RUN: %clang_cc1 -triple x86_64-linux-gnu - gkey-instructions -gno-column-info -x c++ %s -debug-info-kind=line-tables-only -emit-llvm -o - \
22// RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-CXX
33
4- // RUN: %clang_cc1 -gkey-instructions -gno-column-info -x c %s -debug-info-kind=line-tables-only -emit-llvm -o - \
4+ // RUN: %clang_cc1 -triple x86_64-linux-gnu - gkey-instructions -gno-column-info -x c %s -debug-info-kind=line-tables-only -emit-llvm -o - \
55// RUN: | FileCheck %s
66
77// Check the stores to `retval` allocas and branches to `return` block are in
@@ -57,6 +57,7 @@ nomangle int d() { return g = 1; }
5757
5858// The implicit return here get the line number of the closing brace; make it
5959// key to match existing behaviour.
60+ // CHECK: void @e()
6061// CHECK: ret void, !dbg [[E_G1R1:!.*]]
6162nomangle void e () {}
6263
@@ -66,10 +67,17 @@ int &f(int &r) {
6667// Include ctrl-flow to stop ret value store being elided.
6768 if (r )
6869// CHECK-CXX: if.then:
69- // CHECK-CXX-NEXT: %2 = load ptr, ptr %r.addr{{.*}}, !dbg [[F_G2R2:!.*]]
70+ // CHECK-CXX-NEXT: %2 = load ptr, ptr %r.addr{{.*}}, !dbg [[F_G2R2:!.*]], !nonnull
7071// CHECK-CXX-NEXT: store ptr %2, ptr %retval{{.*}}, !dbg [[F_G2R1:!.*]]
7172// CHECK-CXX-NEXT: br label %return, !dbg [[F_G2R1:!.*]]
7273 return r ;
74+
75+ // CHECK-CXX: if.end:
76+ // CHECK-CXX-NEXT: store ptr @g, ptr %retval{{.*}}, !dbg [[F_G3R1:!.*]]
77+ // CHECK-CXX-NEXT: br label %return, !dbg [[F_G3R1:!.*]]
78+ // CHECK-CXX: return:
79+ // CHECK-CXX-NEXT: %3 = load ptr, ptr %retval{{.*}}, !dbg [[F_G4R2:!.*]]
80+ // CHECK-CXX-NEXT: ret ptr %3, !dbg [[F_G4R1:!.*]]
7381 return g ;
7482}
7583#endif
@@ -88,3 +96,6 @@ int &f(int &r) {
8896// CHECK: [[E_G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)
8997// CHECK-CXX: [[F_G2R2]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 2)
9098// CHECK-CXX: [[F_G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)
99+ // CHECK-CXX: [[F_G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)
100+ // CHECK-CXX: [[F_G4R2]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 2)
101+ // CHECK-CXX: [[F_G4R1]] = !DILocation({{.*}}, atomGroup: 4, atomRank: 1)
0 commit comments