brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.3 KiB · 4a6756d Raw
99 lines · cpp
1// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s2 3struct Agg { const char * x; const char * y; constexpr Agg() : x(0), y(0) {} };4 5struct Struct {6   constexpr static const char *name = "foo";7 8   constexpr static __complex float complexValue = 42.0;9 10   static constexpr const Agg &agg = Agg();11 12   Struct();13   Struct(int x);14};15 16void use(int n, const char *c);17 18Struct *getPtr();19 20// CHECK: @[[STR:.*]] = private unnamed_addr constant [4 x i8] c"foo\00", align 121 22void scalarStaticVariableInMemberExpr(Struct *ptr, Struct &ref) {23  use(1, Struct::name);24// CHECK: call void @_Z3useiPKc(i32 noundef 1, ptr noundef @[[STR]])25  Struct s;26  use(2, s.name);27// CHECK: call void @_Z3useiPKc(i32 noundef 2, ptr noundef @[[STR]])28  use(3, ptr->name);29// CHECK: load ptr, ptr %{{.*}}, align 830// CHECK: call void @_Z3useiPKc(i32 noundef 3, ptr noundef @[[STR]])31  use(4, ref.name);32// CHECK: load ptr, ptr %{{.*}}, align 833// CHECK: call void @_Z3useiPKc(i32 noundef 4, ptr noundef @[[STR]])34  use(5, Struct(2).name);35// CHECK: call void @_ZN6StructC1Ei(ptr {{[^,]*}} %{{.*}}, i32 noundef 2)36// CHECK: call void @_Z3useiPKc(i32 noundef 5, ptr noundef @[[STR]])37  use(6, getPtr()->name);38// CHECK: call noundef ptr @_Z6getPtrv()39// CHECK: call void @_Z3useiPKc(i32 noundef 6, ptr noundef @[[STR]])40}41 42void use(int n, __complex float v);43 44void complexStaticVariableInMemberExpr(Struct *ptr, Struct &ref) {45  use(1, Struct::complexValue);46// CHECK: store float 4.200000e+01, ptr %[[coerce0:.*]].{{.*}}, align 447// CHECK: store float 0.000000e+00, ptr %[[coerce0]].{{.*}}, align 448// CHECK: %[[vector0:.*]] = load <2 x float>, ptr %[[coerce0]], align 449// CHECK: call void @_Z3useiCf(i32 noundef 1, <2 x float> noundef %[[vector0]])50  Struct s;51  use(2, s.complexValue);52// CHECK: store float 4.200000e+01, ptr %[[coerce1:.*]].{{.*}}, align 453// CHECK: store float 0.000000e+00, ptr %[[coerce1]].{{.*}}, align 454// CHECK: %[[vector1:.*]] = load <2 x float>, ptr %[[coerce1]], align 455// CHECK: call void @_Z3useiCf(i32 noundef 2, <2 x float> noundef %[[vector1]])56  use(3, ptr->complexValue);57// CHECK: load ptr, ptr %{{.*}}, align 858// CHECK: store float 4.200000e+01, ptr %[[coerce2:.*]].{{.*}}, align 459// CHECK: store float 0.000000e+00, ptr %[[coerce2]].{{.*}}, align 460// CHECK: %[[vector2:.*]] = load <2 x float>, ptr %[[coerce2]], align 461// CHECK: call void @_Z3useiCf(i32 noundef 3, <2 x float> noundef %[[vector2]])62  use(4, ref.complexValue);63// CHECK: load ptr, ptr %{{.*}}, align 864// CHECK: store float 4.200000e+01, ptr %[[coerce3:.*]].{{.*}}, align 465// CHECK: store float 0.000000e+00, ptr %[[coerce3]].{{.*}}, align 466// CHECK: %[[vector3:.*]] = load <2 x float>, ptr %[[coerce3]], align 467// CHECK: call void @_Z3useiCf(i32 noundef 4, <2 x float> noundef %[[vector3]])68  use(5, Struct(2).complexValue);69// CHECK: call void @_ZN6StructC1Ei(ptr {{[^,]*}} %{{.*}}, i32 noundef 2)70// CHECK: store float 4.200000e+01, ptr %[[coerce4:.*]].{{.*}}, align 471// CHECK: store float 0.000000e+00, ptr %[[coerce4]].{{.*}}, align 472// CHECK: %[[vector4:.*]] = load <2 x float>, ptr %[[coerce4]], align 473// CHECK: call void @_Z3useiCf(i32 noundef 5, <2 x float> noundef %[[vector4]])74  use(6, getPtr()->complexValue);75// CHECK: call noundef ptr @_Z6getPtrv()76// CHECK: store float 4.200000e+01, ptr %[[coerce5:.*]].{{.*}}, align 477// CHECK: store float 0.000000e+00, ptr %[[coerce5]].{{.*}}, align 478// CHECK: %[[vector5:.*]] = load <2 x float>, ptr %[[coerce5]], align 479// CHECK: call void @_Z3useiCf(i32 noundef 6, <2 x float> noundef %[[vector5]])80}81 82void aggregateRefInMemberExpr(Struct *ptr, Struct &ref) {83  use(1, Struct::agg.x);84// CHECK: %[[value0:.*]] = load ptr, ptr @_ZGRN6Struct3aggE_, align 885// CHECK: call void @_Z3useiPKc(i32 noundef 1, ptr noundef %[[value0]])86  Struct s;87  use(2, s.agg.x);88// CHECK: %[[value1:.*]] = load ptr, ptr @_ZGRN6Struct3aggE_, align 889// CHECK: call void @_Z3useiPKc(i32 noundef 2, ptr noundef %[[value1]])90  use(3, ptr->agg.x);91// CHECK: load ptr, ptr %{{.*}}, align 892// CHECK: %[[value2:.*]] = load ptr, ptr @_ZGRN6Struct3aggE_, align 893// CHECK: call void @_Z3useiPKc(i32 noundef 3, ptr noundef %[[value2]])94  use(4, ref.agg.x);95// CHECK: load ptr, ptr %{{.*}}, align 896// CHECK: %[[value3:.*]] = load ptr, ptr @_ZGRN6Struct3aggE_, align 897// CHECK: call void @_Z3useiPKc(i32 noundef 4, ptr noundef %[[value3]])98}99