Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGen / functions.c
blob1bbaa80d653c4b2ca09f5f4e9ea952872e7d57e1
1 // RUN: %clang_cc1 %s -triple i386-unknown-unknown -Wno-strict-prototypes -emit-llvm -o - -verify | FileCheck %s
3 int g();
5 int foo(int i) {
6 return g(i);
9 int g(int i) {
10 return g(i);
13 typedef void T(void);
14 void test3(T f) {
15 f();
18 void f0(void) {}
19 // CHECK-LABEL: define{{.*}} void @f0()
21 void f1();
22 void f2(void) {
23 // CHECK: call void @f1()
24 f1(1, 2, 3);
26 // CHECK-LABEL: define{{.*}} void @f1()
27 void f1() {}
29 // CHECK: define {{.*}} @f3{{\(\)|\(.*sret.*\)}}
30 struct foo { int X, Y, Z; } f3(void) {
31 while (1) {}
34 // PR4423 - This shouldn't crash in codegen
35 void f4() {}
36 void f5(void) { f4(42); } //expected-warning {{too many arguments}}
38 // Qualifiers on parameter types shouldn't make a difference.
39 static void f6(const float f, const float g) {
41 void f7(float f, float g) {
42 f6(f, g);
43 // CHECK: define{{.*}} void @f7(float{{.*}}, float{{.*}})
44 // CHECK: call void @f6(float{{.*}}, float{{.*}})
47 // PR6911 - incomplete function types
48 struct Incomplete;
49 void f8_callback(struct Incomplete);
50 void f8_user(void (*callback)(struct Incomplete));
51 void f8_test(void) {
52 f8_user(&f8_callback);
53 // CHECK-LABEL: define{{.*}} void @f8_test()
54 // CHECK: call void @f8_user(ptr noundef @f8_callback)
55 // CHECK: declare void @f8_user(ptr noundef)
56 // CHECK: declare void @f8_callback()
59 // PR10204: don't crash
60 static void test9_helper(void) {}
61 void test9(void) {
62 (void) test9_helper;