summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/merge-functions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGenCXX/merge-functions.cpp')
-rw-r--r--test/CodeGenCXX/merge-functions.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/CodeGenCXX/merge-functions.cpp b/test/CodeGenCXX/merge-functions.cpp
new file mode 100644
index 0000000..2137f19
--- /dev/null
+++ b/test/CodeGenCXX/merge-functions.cpp
@@ -0,0 +1,14 @@
+// REQUIRES: x86-registered-target
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -O1 -fmerge-functions -emit-llvm -o - -x c++ < %s | FileCheck %s
+
+// Basic functionality test. Function merging doesn't kick in on functions that
+// are too simple.
+
+struct A {
+ virtual int f(int x, int *p) { return x ? *p : 1; }
+ virtual int g(int x, int *p) { return x ? *p : 1; }
+} a;
+
+// CHECK: define {{.*}} @_ZN1A1gEiPi
+// CHECK-NEXT: tail call i32 @_ZN1A1fEiPi
+// CHECK-NEXT: ret
OpenPOWER on IntegriCloud