Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / default-arguments-with-immediate.cpp
blob54a02ffc0683603ba30a02e8bab76b075fa95d4e
1 // RUN: %clang_cc1 -std=c++2a -triple x86_64-elf-gnu %s -emit-llvm -o - | FileCheck %s
3 consteval int immediate() { return 0;}
4 static int ext();
5 void f(int a = immediate() + ext());
7 void test_function() {
8 f();
9 f(0);
10 // CHECK: call noundef i32 @_ZL3extv()
11 // CHECK: add
12 // CHECK: call {{.*}} @_Z1fi
13 // CHECK: call {{.*}} @_Z1fi
16 // CHECK: define {{.*}} i32 @_ZL3extv()
18 static constexpr int not_immediate();
19 struct A {
20 int a = immediate() + not_immediate();
23 void test_member() {
24 // CHECK: call void @_ZN1AC2Ev
25 A defaulted;
26 // CHECK-NOT: call void @_ZN1AC2Ev
27 A provided{0};
30 // CHECK: define {{.*}} void @_ZN1AC2Ev{{.*}}
31 // CHECK: %call = call noundef i32 @_ZL13not_immediatev()
33 int never_referenced() {return 42;};
36 namespace not_used {
38 struct A {
39 int a = immediate() + never_referenced();
41 void f(int a = immediate() + never_referenced());
43 void g() {
44 A a{0};
45 f(0);
50 static int ext() {return 0;}
51 static constexpr int not_immediate() {return 0;}
53 // CHECK-NOT: define {{.*}} i32 _ZL16never_referencedv()(
54 // CHECK: define {{.*}} i32 @_ZL13not_immediatev()