Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / x86_32-arguments.cpp
blob7388b2fcfe6cdddfe8d51c3e2681403b79516862
1 // RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o - %s | FileCheck %s
3 // Non-trivial dtors, should both be passed indirectly.
4 struct S {
5 ~S();
6 short s;
7 };
9 // CHECK-LABEL: define{{.*}} void @_Z1fv(ptr noalias sret(%struct.S) align 2 %
10 S f() { return S(); }
11 // CHECK-LABEL: define{{.*}} void @_Z1f1S(ptr noundef %0)
12 void f(S) { }
14 // Non-trivial dtors, should both be passed indirectly.
15 class C {
16 public:
17 ~C();
18 double c;
21 // CHECK-LABEL: define{{.*}} void @_Z1gv(ptr noalias sret(%class.C) align 4 %
22 C g() { return C(); }
24 // CHECK-LABEL: define{{.*}} void @_Z1f1C(ptr noundef %0)
25 void f(C) { }
30 // PR7058 - Missing byval on MI thunk definition.
32 // CHECK-LABEL: define{{.*}} void @_ZThn4_N18BasicAliasAnalysis13getModRefInfoE8CallSite
33 // ...
34 // CHECK: ptr noundef byval(%struct.CallSite) align 4 %CS)
35 struct CallSite {
36 unsigned Ptr;
37 CallSite(unsigned XX) : Ptr(XX) {}
40 struct AliasAnalysis {
41 virtual void xyz();
42 virtual void getModRefInfo(CallSite CS) = 0;
45 struct ModulePass {
46 virtual void xx();
49 struct BasicAliasAnalysis : public ModulePass, public AliasAnalysis {
50 void getModRefInfo(CallSite CS);
53 void BasicAliasAnalysis::getModRefInfo(CallSite CS) {
56 // Check various single element struct type conditions.
58 // PR7098.
60 // CHECK-LABEL: define{{.*}} i64 @_Z2f0v()
61 struct s0_0 { int x; };
62 struct s0_1 : s0_0 { int* y; };
63 s0_1 f0() { return s0_1(); }
65 // CHECK-LABEL: define{{.*}} i32 @_Z2f1v()
66 struct s1_0 { int x; };
67 struct s1_1 : s1_0 { };
68 s1_1 f1() { return s1_1(); }
70 // CHECK-LABEL: define{{.*}} double @_Z2f2v()
71 struct s2_0 { double x; };
72 struct s2_1 : s2_0 { };
73 s2_1 f2() { return s2_1(); }
75 // CHECK-LABEL: define{{.*}} double @_Z2f3v()
76 struct s3_0 { };
77 struct s3_1 { double x; };
78 struct s3_2 : s3_0, s3_1 { };
79 s3_2 f3() { return s3_2(); }
81 // CHECK-LABEL: define{{.*}} i64 @_Z2f4v()
82 struct s4_0 { float x; };
83 struct s4_1 { float x; };
84 struct s4_2 : s4_0, s4_1 { };
85 s4_2 f4() { return s4_2(); }
87 // CHECK-LABEL: define{{.*}} ptr @_Z2f5v()
88 struct s5 { s5(); int &x; };
89 s5 f5() { return s5(); }
91 // CHECK-LABEL: define{{.*}} i32 @_Z4f6_0M2s6i(i32 %a)
92 // CHECK: define{{.*}} i64 @_Z4f6_1M2s6FivE(ptr noundef byval({ i32, i32 }) align 4 %0)
93 // FIXME: It would be nice to avoid byval on the previous case.
94 struct s6 {};
95 typedef int s6::* s6_mdp;
96 typedef int (s6::*s6_mfp)();
97 s6_mdp f6_0(s6_mdp a) { return a; }
98 s6_mfp f6_1(s6_mfp a) { return a; }
100 // CHECK-LABEL: define{{.*}} double @_Z2f7v()
101 struct s7_0 { unsigned : 0; };
102 struct s7_1 { double x; };
103 struct s7 : s7_0, s7_1 { };
104 s7 f7() { return s7(); }
106 // CHECK-LABEL: define{{.*}} void @_Z2f8v(ptr noalias sret(%struct.s8) align 4 %agg.result)
107 struct s8_0 { };
108 struct s8_1 { double x; };
109 struct s8 { s8_0 a; s8_1 b; };
110 s8 f8() { return s8(); }
112 // CHECK-LABEL: define{{.*}} void @_Z2f9v(ptr noalias sret(%struct.s9) align 4 %agg.result)
113 struct s9_0 { unsigned : 0; };
114 struct s9_1 { double x; };
115 struct s9 { s9_0 a; s9_1 b; };
116 s9 f9() { return s9(); }