Under a compiler flag, -freset-local-blocks,
wipe out stack blocks when they go out of scope.
// rdar://9227352


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134045 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGen/reset-local-block.c b/test/CodeGen/reset-local-block.c
new file mode 100644
index 0000000..01b8828
--- /dev/null
+++ b/test/CodeGen/reset-local-block.c
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm  -fblocks -freset-local-blocks -o - %s | FileCheck %s
+// rdar://9227352
+
+typedef int (^BLOCK)();
+
+BLOCK FUNC() {
+  int i;
+  double d;
+  BLOCK block = ^{ return i + (int)d; };
+  if (!block)
+    block = ^{ return i; };
+  return block;
+}
+
+//CHECK: call void @llvm.memset{{.*}}, i8 -51, i64 36, i32 8, i1 false)
+//CHECK: call void @llvm.memset{{.*}}, i8 -51, i64 44, i32 8, i1 false)