summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/lifetime-debuginfo-2.c
diff options
context:
space:
mode:
authorArnaud A. de Grandmaison <arnaud.degrandmaison@arm.com>2015-04-10 10:13:52 +0000
committerArnaud A. de Grandmaison <arnaud.degrandmaison@arm.com>2015-04-10 10:13:52 +0000
commit047a686d535ebde7b733e5f4dacdc0be1ce24da4 (patch)
treea2dd9fdc96c34a5b1bf2f9d32b0362fe1e93f91b /clang/test/CodeGen/lifetime-debuginfo-2.c
parentb56dff5729d985d80f76d699fbb56e2ce854183e (diff)
downloadbcm5719-llvm-047a686d535ebde7b733e5f4dacdc0be1ce24da4.tar.gz
bcm5719-llvm-047a686d535ebde7b733e5f4dacdc0be1ce24da4.zip
Remove threshold for inserting lifetime markers for named temporaries
Now that TailRecursionElimination has been fixed with r222354, the threshold on size for lifetime marker insertion can be removed. This only affects named temporary though, as the patch for unnamed temporaries is still in progress. My previous commit (r222993) was not handling debuginfo correctly, but this could only be seen with some asan tests. Basically, lifetime markers are just instrumentation for the compiler's usage and should not affect debug information; however, the cleanup infrastructure was assuming it contained only destructors, i.e. actual code to be executed, and was setting the breakpoint for the end of the function to the closing '}', and not the return statement, in order to show some destructors have been called when leaving the function. This is wrong when the cleanups are only lifetime markers, and this is now fixed. llvm-svn: 234581
Diffstat (limited to 'clang/test/CodeGen/lifetime-debuginfo-2.c')
-rw-r--r--clang/test/CodeGen/lifetime-debuginfo-2.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/clang/test/CodeGen/lifetime-debuginfo-2.c b/clang/test/CodeGen/lifetime-debuginfo-2.c
new file mode 100644
index 00000000000..db01c81db6d
--- /dev/null
+++ b/clang/test/CodeGen/lifetime-debuginfo-2.c
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 -O1 -triple x86_64-none-linux-gnu -emit-llvm -gline-tables-only %s -o - | FileCheck %s
+
+// Inserting lifetime markers should not affect debuginfo: lifetime.end is not
+// a destructor, but instrumentation for the compiler. Ensure the debug info for
+// the return statement (in the IR) does not point to the function closing '}'
+// which is used to show some destructors have been called before leaving the
+// function.
+
+extern int f(int);
+extern int g(int);
+
+// CHECK-LABEL: define i32 @test
+int test(int a, int b) {
+ int res;
+
+ if (a==2) {
+ int r = f(b);
+ res = r + b;
+ a += 2;
+ } else {
+ int r = f(a);
+ res = r + a;
+ b += 1;
+ }
+
+ return res;
+// CHECK: ret i32 %{{.*}}, !dbg [[DI:![0-9]+]]
+// CHECK: [[DI]] = !MDLocation(line: [[@LINE-2]]
+}
OpenPOWER on IntegriCloud