Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / function-template-specialization.cpp
blob7728f3dc746244ba0474980d114578f370e8cd36
1 // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple %s -o - | FileCheck %s
3 // CHECK-DAG: _ZZN7PR219047GetDataIiEERKibE1i = internal global i32 4
4 // CHECK-DAG: _ZZN7PR219047GetDataIiEERKibE1i_0 = internal global i32 2
6 template<typename T, typename U>
7 T* next(T* ptr, const U& diff);
9 template<typename T, typename U>
10 T* next(T* ptr, const U& diff) {
11 return ptr + diff;
14 void test(int *iptr, float *fptr, int diff) {
15 // CHECK: _Z4nextIiiEPT_S1_RKT0_
16 iptr = next(iptr, diff);
18 // CHECK: _Z4nextIfiEPT_S1_RKT0_
19 fptr = next(fptr, diff);
22 template<typename T, typename U>
23 T* next(T* ptr, const U& diff);
25 void test2(int *iptr, double *dptr, int diff) {
26 iptr = next(iptr, diff);
28 // CHECK: _Z4nextIdiEPT_S1_RKT0_
29 dptr = next(dptr, diff);
32 namespace PR21904 {
33 template <typename>
34 const int &GetData(bool);
36 template <>
37 const int &GetData<int>(bool b) {
38 static int i = 4;
39 if (b) {
40 static int i = 2;
41 return i;
43 return i;