diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:02:28 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:02:28 +0000 |
| commit | 7442d6faa2719e4e7d33a7021c406c5a4facd74d (patch) | |
| tree | c72b9241553fc9966179aba84f90f17bfa9235c3 /test/CodeGen/blocks.c | |
| parent | b52119637f743680a99710ce5fdb6646da2772af (diff) | |
Notes
Diffstat (limited to 'test/CodeGen/blocks.c')
| -rw-r--r-- | test/CodeGen/blocks.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/CodeGen/blocks.c b/test/CodeGen/blocks.c index 2a8182691156..911c63e41d34 100644 --- a/test/CodeGen/blocks.c +++ b/test/CodeGen/blocks.c @@ -78,3 +78,37 @@ int main() { // CHECK: [[ONE:%.*]] = bitcast void (...)* [[ZERO]] to void ()* // CHECK-NEXT: br label [[CE:%.*]] +// Ensure that we don't emit helper code in copy/dispose routines for variables +// that are const-captured. +void testConstCaptureInCopyAndDestroyHelpers() { + const int x = 0; + __block int i; + (^ { i = x; })(); +} +// CHECK-LABEL: testConstCaptureInCopyAndDestroyHelpers_block_invoke + +// CHECK: @__copy_helper_block +// CHECK: alloca +// CHECK-NEXT: alloca +// CHECK-NEXT: store +// CHECK-NEXT: store +// CHECK-NEXT: load +// CHECK-NEXT: bitcast +// CHECK-NEXT: load +// CHECK-NEXT: bitcast +// CHECK-NEXT: getelementptr +// CHECK-NEXT: getelementptr +// CHECK-NEXT: load +// CHECK-NEXT: bitcast +// CHECK-NEXT: call void @_Block_object_assign +// CHECK-NEXT: ret + +// CHECK: @__destroy_helper_block +// CHECK: alloca +// CHECK-NEXT: store +// CHECK-NEXT: load +// CHECK-NEXT: bitcast +// CHECK-NEXT: getelementptr +// CHECK-NEXT: load +// CHECK-NEXT: call void @_Block_object_dispose +// CHECK-NEXT: ret |
