2010-05-12 05:15:36 +08:00
|
|
|
// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o - %s | FileCheck %s
|
2010-01-27 11:22:55 +08:00
|
|
|
|
|
|
|
// Non-trivial dtors, should both be passed indirectly.
|
|
|
|
struct S {
|
|
|
|
~S();
|
2010-05-06 06:55:13 +08:00
|
|
|
short s;
|
2010-01-27 11:22:55 +08:00
|
|
|
};
|
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_Z1fv(%struct.S* noalias sret %
|
2010-01-27 11:22:55 +08:00
|
|
|
S f() { return S(); }
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_Z1f1S(%struct.S*)
|
2010-01-27 11:22:55 +08:00
|
|
|
void f(S) { }
|
|
|
|
|
|
|
|
// Non-trivial dtors, should both be passed indirectly.
|
|
|
|
class C {
|
2010-05-12 05:15:36 +08:00
|
|
|
public:
|
2010-01-27 11:22:55 +08:00
|
|
|
~C();
|
|
|
|
double c;
|
|
|
|
};
|
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_Z1gv(%class.C* noalias sret %
|
2010-01-27 11:22:55 +08:00
|
|
|
C g() { return C(); }
|
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_Z1f1C(%class.C*)
|
2010-01-27 11:22:55 +08:00
|
|
|
void f(C) { }
|
2010-05-06 06:55:13 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// PR7058 - Missing byval on MI thunk definition.
|
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_ZThn4_N18BasicAliasAnalysis13getModRefInfoE8CallSite
|
2010-05-06 06:55:13 +08:00
|
|
|
// ...
|
2019-06-06 05:12:14 +08:00
|
|
|
// CHECK: %struct.CallSite* byval(%struct.CallSite) align 4 %CS)
|
2010-05-06 06:55:13 +08:00
|
|
|
struct CallSite {
|
|
|
|
unsigned Ptr;
|
|
|
|
CallSite(unsigned XX) : Ptr(XX) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct AliasAnalysis {
|
|
|
|
virtual void xyz();
|
|
|
|
virtual void getModRefInfo(CallSite CS) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ModulePass {
|
|
|
|
virtual void xx();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct BasicAliasAnalysis : public ModulePass, public AliasAnalysis {
|
|
|
|
void getModRefInfo(CallSite CS);
|
|
|
|
};
|
|
|
|
|
|
|
|
void BasicAliasAnalysis::getModRefInfo(CallSite CS) {
|
|
|
|
}
|
2010-05-12 05:15:36 +08:00
|
|
|
|
|
|
|
// Check various single element struct type conditions.
|
|
|
|
//
|
|
|
|
// PR7098.
|
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define i64 @_Z2f0v()
|
2010-05-12 05:15:36 +08:00
|
|
|
struct s0_0 { int x; };
|
|
|
|
struct s0_1 : s0_0 { int* y; };
|
|
|
|
s0_1 f0() { return s0_1(); }
|
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define i32 @_Z2f1v()
|
2010-05-12 05:15:36 +08:00
|
|
|
struct s1_0 { int x; };
|
|
|
|
struct s1_1 : s1_0 { };
|
|
|
|
s1_1 f1() { return s1_1(); }
|
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define double @_Z2f2v()
|
2010-05-12 05:15:36 +08:00
|
|
|
struct s2_0 { double x; };
|
|
|
|
struct s2_1 : s2_0 { };
|
|
|
|
s2_1 f2() { return s2_1(); }
|
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define double @_Z2f3v()
|
2010-05-12 05:15:36 +08:00
|
|
|
struct s3_0 { };
|
|
|
|
struct s3_1 { double x; };
|
|
|
|
struct s3_2 : s3_0, s3_1 { };
|
|
|
|
s3_2 f3() { return s3_2(); }
|
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define i64 @_Z2f4v()
|
2010-05-12 05:15:36 +08:00
|
|
|
struct s4_0 { float x; };
|
|
|
|
struct s4_1 { float x; };
|
|
|
|
struct s4_2 : s4_0, s4_1 { };
|
|
|
|
s4_2 f4() { return s4_2(); }
|
2010-05-14 11:40:53 +08:00
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define i32* @_Z2f5v()
|
2010-05-14 11:40:53 +08:00
|
|
|
struct s5 { s5(); int &x; };
|
|
|
|
s5 f5() { return s5(); }
|
2010-05-15 08:00:30 +08:00
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define i32 @_Z4f6_0M2s6i(i32 %a)
|
2019-06-06 05:12:14 +08:00
|
|
|
// CHECK: define i64 @_Z4f6_1M2s6FivE({ i32, i32 }* byval({ i32, i32 }) align 4)
|
2010-05-15 08:00:30 +08:00
|
|
|
// FIXME: It would be nice to avoid byval on the previous case.
|
|
|
|
struct s6 {};
|
|
|
|
typedef int s6::* s6_mdp;
|
|
|
|
typedef int (s6::*s6_mfp)();
|
|
|
|
s6_mdp f6_0(s6_mdp a) { return a; }
|
|
|
|
s6_mfp f6_1(s6_mfp a) { return a; }
|
2010-05-18 00:46:00 +08:00
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define double @_Z2f7v()
|
2010-05-18 00:46:00 +08:00
|
|
|
struct s7_0 { unsigned : 0; };
|
|
|
|
struct s7_1 { double x; };
|
|
|
|
struct s7 : s7_0, s7_1 { };
|
|
|
|
s7 f7() { return s7(); }
|
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_Z2f8v(%struct.s8* noalias sret %agg.result)
|
2010-05-18 00:46:00 +08:00
|
|
|
struct s8_0 { };
|
|
|
|
struct s8_1 { double x; };
|
|
|
|
struct s8 { s8_0 a; s8_1 b; };
|
|
|
|
s8 f8() { return s8(); }
|
|
|
|
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @_Z2f9v(%struct.s9* noalias sret %agg.result)
|
2010-05-18 00:46:00 +08:00
|
|
|
struct s9_0 { unsigned : 0; };
|
|
|
|
struct s9_1 { double x; };
|
|
|
|
struct s9 { s9_0 a; s9_1 b; };
|
|
|
|
s9 f9() { return s9(); }
|