summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/observe-noexcept.cpp
diff options
context:
space:
mode:
authorSamuel Antao <sfantao@us.ibm.com>2015-11-23 22:04:44 +0000
committerSamuel Antao <sfantao@us.ibm.com>2015-11-23 22:04:44 +0000
commit0cb5f3abb0de5d03e98e87256a3f369ad2a0e205 (patch)
treef23d98402e4b357d568f8edcf6da172ca39653e1 /test/CodeGenCXX/observe-noexcept.cpp
parentaffe30e522ba1f222a8c4f634655e75f93ea2bb8 (diff)
Preserve exceptions information during calls code generation.
This patch changes the generation of CGFunctionInfo to contain the FunctionProtoType if it is available. This enables the code generation for call instructions to look into this type for exception information and therefore generate better quality IR - it will not create invoke instructions for functions that are know not to throw. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253926 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/observe-noexcept.cpp')
-rw-r--r--test/CodeGenCXX/observe-noexcept.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/CodeGenCXX/observe-noexcept.cpp b/test/CodeGenCXX/observe-noexcept.cpp
new file mode 100644
index 0000000000..76046a6168
--- /dev/null
+++ b/test/CodeGenCXX/observe-noexcept.cpp
@@ -0,0 +1,47 @@
+// RUN: %clang_cc1 -triple powerpc64le-unknown-unknown -std=c++11 -fopenmp -fexceptions -fcxx-exceptions -O0 -emit-llvm %s -o - | FileCheck %s
+
+// Check that regions that install a terminate scope in the exception stack can
+// correctly generate complex arithmetic.
+
+// CHECK-LABEL: ffcomplex
+void ffcomplex (int a) {
+ double _Complex dc = (double)a;
+
+ // CHECK: call { double, double } @__muldc3(double %{{.+}}, double %{{.+}}, double %{{.+}}, double %{{.+}})
+ dc *= dc;
+ // CHECK: call {{.+}} @__kmpc_fork_call({{.+}} [[REGNAME1:@.*]] to void (i32*, i32*, ...)*), { double, double }* %{{.+}})
+ #pragma omp parallel
+ {
+ dc *= dc;
+ }
+ // CHECK: ret void
+}
+
+// CHECK: define internal {{.+}}[[REGNAME1]](
+// CHECK-NOT: invoke
+// CHECK: call { double, double } @__muldc3(double %{{.+}}, double %{{.+}}, double %{{.+}}, double %{{.+}})
+// CHECK-NOT: invoke
+// CHECK: ret void
+
+// Check if we are observing the function pointer attribute regardless what is
+// in the exception specification of the callees.
+void fnoexcp(void) noexcept;
+
+// CHECK-LABEL: foo
+void foo(int a, int b) {
+
+ void (*fptr)(void) noexcept = fnoexcp;
+
+ // CHECK: call {{.+}} @__kmpc_fork_call({{.+}} [[REGNAME2:@.*]] to void (i32*, i32*, ...)*), void ()** %{{.+}})
+ #pragma omp parallel
+ {
+ fptr();
+ }
+ // CHECK: ret void
+}
+
+// CHECK: define internal {{.+}}[[REGNAME2]](
+// CHECK-NOT: invoke
+// CHECK: call void %{{[0-9]+}}()
+// CHECK-NOT: invoke
+// CHECK: ret void