diff options
author | Adrian Prantl <aprantl@apple.com> | 2017-10-26 18:16:05 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2017-10-26 18:16:05 +0000 |
commit | 1c45b09add3b9a254af8b85c9cbc37f16fc34f92 (patch) | |
tree | b0792be31450825433ae8c82590f8c53512aa34f /clang/test/CodeGen/debug-info-block-vars.c | |
parent | 9b4e32785ab10c28240634aa0a2a2f5100704d6f (diff) | |
download | bcm5719-llvm-1c45b09add3b9a254af8b85c9cbc37f16fc34f92.tar.gz bcm5719-llvm-1c45b09add3b9a254af8b85c9cbc37f16fc34f92.zip |
Simplify codegen and debug info generation for block context parameters.
The exisiting code goes out of its way to put block parameters into an
alloca only at -O0, and then describes the funciton argument with a
dbg.declare, which is undocumented in the LLVM-CFE contract and does
not actually behave as intended after LLVM r642022.
This patch just generates the alloca unconditionally, the mem2reg pass
will eliminate it at -O1 and up anyway and points the dbg.declare to
the alloca as intended (which mem2reg will then correctly rewrite into
a dbg.value).
rdar://problem/35043980
Differential Revision: https://reviews.llvm.org/D39305
llvm-svn: 316684
Diffstat (limited to 'clang/test/CodeGen/debug-info-block-vars.c')
-rw-r--r-- | clang/test/CodeGen/debug-info-block-vars.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/CodeGen/debug-info-block-vars.c b/clang/test/CodeGen/debug-info-block-vars.c new file mode 100644 index 00000000000..e0bb61e5e85 --- /dev/null +++ b/clang/test/CodeGen/debug-info-block-vars.c @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -x c -fblocks -debug-info-kind=standalone -emit-llvm -O0 \ +// RUN: -triple x86_64-apple-darwin -o - %s | FileCheck %s +// RUN: %clang_cc1 -x c -fblocks -debug-info-kind=standalone -emit-llvm -O1 \ +// RUN: -triple x86_64-apple-darwin -o - %s \ +// RUN: | FileCheck --check-prefix=CHECK-OPT %s + +// CHECK: define internal void @__f_block_invoke(i8* %.block_descriptor) +// CHECK: %.block_descriptor.addr = alloca i8*, align 8 +// CHECK: %block.addr = alloca <{ i8*, i32, i32, i8*, %struct.__block_descriptor* }>*, align 8 +// CHECK: store i8* %.block_descriptor, i8** %.block_descriptor.addr, align 8 +// CHECK: call void @llvm.dbg.declare(metadata i8** %.block_descriptor.addr, +// CHECK-SAME: metadata !DIExpression()) +// CHECK-OPT-NOT: alloca +// CHECK-OPT: call void @llvm.dbg.value(metadata i8* %.block_descriptor, +// CHECK-OPT-SAME: metadata !DIExpression()) +void f() { + a(^{ + b(); + }); +} |