From 4fdbc0728d4b8acb1921fc48301622e971fc3961 Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Sat, 14 Sep 2019 19:43:16 -0700 Subject: [DWARF] Handle call sites with indirect call targets Split CallEdge into DirectCallEdge and IndirectCallEdge. Teach DWARFExpression how to evaluate entry values in cases where the current activation was created by an indirect call. rdar://57094085 Differential Revision: https://reviews.llvm.org/D70100 --- .../basic_entry_values_x86_64/main.cpp | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'lldb/packages/Python/lldbsuite') diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp index 5a38376b680..ff72a81c6b2 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp +++ b/lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp @@ -140,6 +140,34 @@ void func12(int &sink, int x) { func11_tailcalled(sink, x); } +__attribute__((noinline)) +void func13(int &sink, int x) { + //% self.filecheck("bt", "main.cpp", "-check-prefix=FUNC13-BT") + // FUNC13-BT: func13{{.*}} + // FUNC13-BT-NEXT: func14{{.*}} + use(x); + + // Destroy 'x' in the current frame. + DESTROY_RSI; + + //% self.filecheck("expr x", "main.cpp", "-check-prefix=FUNC13-EXPR") + // FUNC13-EXPR: (int) ${{.*}} = 123 + + ++sink; +} + +__attribute__((noinline, disable_tail_calls)) +void func14(int &sink, void (*target_no_tailcall)(int &, int)) { + // Move the call target into a register that won't get clobbered. Do this + // by calling the same indirect target twice, and hoping that regalloc is + // 'smart' enough to stash the call target in a non-clobbered register. + // + // llvm.org/PR43926 tracks work in the compiler to emit call targets which + // describe non-clobbered values. + target_no_tailcall(sink, 123); + target_no_tailcall(sink, 123); +} + __attribute__((disable_tail_calls)) int main() { int sink = 0; @@ -168,5 +196,8 @@ int main() { // Test that evaluation can "see through" tail calls. func12(sink, 123); + // Test that evaluation can "see through" an indirect tail call. + func14(sink, func13); + return 0; } -- cgit v1.2.3