-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CGDebugInfo] Emit subprograms for decls when AT_tail_call is underst…
…ood (reland with fixes) Currently, clang emits subprograms for declared functions when the target debugger or DWARF standard is known to support entry values (DW_OP_entry_value & the GNU equivalent). Treat DW_AT_tail_call the same way to allow debuggers to follow cross-TU tail calls. Pre-patch debug session with a cross-TU tail call: ``` * frame #0: 0x0000000100000fa4 main`target at b.c:4:3 [opt] frame #1: 0x0000000100000f99 main`main at a.c:8:10 [opt] ``` Post-patch (note that the tail-calling frame, "helper", is visible): ``` * frame #0: 0x0000000100000fa4 main`target at b.c:4:3 [opt] frame #1: 0x0000000100000f80 main`helper [opt] [artificial] frame #2: 0x0000000100000f99 main`main at a.c:8:10 [opt] ``` This was reverted in 5b9a072 because it attached declaration subprograms to inlinable builtin calls, which interacted badly with the MergeICmps pass. The fix is to not attach declarations to builtins. rdar://46577651 Differential Revision: https://reviews.llvm.org/D69743
- Loading branch information
Showing
6 changed files
with
72 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,39 @@ | ||
// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -target x86_64-none-linux-gnu -S -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-EXT | ||
// CHECK-EXT: !DISubprogram(name: "fn1" | ||
// When entry values are emitted, expect a subprogram for extern decls so that | ||
// the dwarf generator can describe call site parameters at extern call sites. | ||
// | ||
// RUN: %clang -Xclang -femit-debug-entry-values -g -O2 -target x86_64-none-linux-gnu -S -emit-llvm %s -o - \ | ||
// RUN: | FileCheck %s -check-prefix=DECLS-FOR-EXTERN | ||
|
||
// RUN: %clang -g -O2 -target x86_64-none-linux-gnu -S -emit-llvm %s -o - | FileCheck %s | ||
// CHECK-NOT: !DISubprogram(name: "fn1" | ||
// Similarly, when the debugger tuning is gdb, expect a subprogram for extern | ||
// decls so that the dwarf generator can describe information needed for tail | ||
// call frame reconstrution. | ||
// | ||
// RUN: %clang -g -O2 -target x86_64-none-linux-gnu -ggdb -S -emit-llvm %s -o - \ | ||
// RUN: | FileCheck %s -check-prefix=DECLS-FOR-EXTERN | ||
// | ||
// Do not emit a subprogram for extern decls when entry values are disabled and | ||
// the tuning is not set to gdb. | ||
// | ||
// RUN: %clang -g -O2 -target x86_64-none-linux-gnu -gsce -S -emit-llvm %s -o - \ | ||
// RUN: | FileCheck %s -check-prefix=NO-DECLS-FOR-EXTERN | ||
|
||
// DECLS-FOR-EXTERN: !DISubprogram(name: "fn1" | ||
// DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "memcmp" | ||
// DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "__some_reserved_name" | ||
|
||
// NO-DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "fn1" | ||
// NO-DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "memcmp" | ||
// NO-DECLS-FOR-EXTERN-NOT: !DISubprogram(name: "__some_reserved_name" | ||
|
||
extern int fn1(int a, int b); | ||
extern int memcmp(const void *s1, const void *s2, unsigned long n); | ||
extern void __some_reserved_name(void); | ||
|
||
int fn2 () { | ||
int fn2 (int *src, int *dst) { | ||
int x = 4, y = 5; | ||
int res = fn1(x, y); | ||
|
||
return res; | ||
int res2 = memcmp(dst, src, res); | ||
__some_reserved_name(); | ||
return res + res2; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters