1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
2 ; RUN: opt -passes="default<O1>" -S < %s | FileCheck --check-prefixes=O1 %s
3 ; RUN: opt -passes="default<O2>" -S < %s | FileCheck --check-prefixes=O23 %s
4 ; RUN: opt -passes="default<O3>" -S < %s | FileCheck --check-prefixes=O23 %s
6 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
7 target triple = "x86_64-unknown-linux-gnu"
9 %class.FloatVecPair = type { %class.HomemadeVector, %class.HomemadeVector }
10 %class.HomemadeVector = type <{ %class.HomemadeVector.0*, i32, [4 x i8] }>
11 %class.HomemadeVector.0 = type <{ float*, i32, [4 x i8] }>
13 $_ZN12FloatVecPair6vecIncEv = comdat any
15 define dso_local void @_Z13vecIncFromPtrP12FloatVecPair(%class.FloatVecPair* %FVP) {
16 ; O1-LABEL: define {{[^@]+}}@_Z13vecIncFromPtrP12FloatVecPair
17 ; O1-SAME: (%class.FloatVecPair* nocapture readonly [[FVP:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
19 ; O1-NEXT: [[BASE_I_I:%.*]] = getelementptr inbounds [[CLASS_FLOATVECPAIR:%.*]], %class.FloatVecPair* [[FVP]], i64 0, i32 1, i32 0
20 ; O1-NEXT: [[TMP0:%.*]] = load %class.HomemadeVector.0*, %class.HomemadeVector.0** [[BASE_I_I]], align 8, !tbaa [[TBAA0:![0-9]+]]
21 ; O1-NEXT: [[SIZE4_I:%.*]] = getelementptr inbounds [[CLASS_HOMEMADEVECTOR_0:%.*]], %class.HomemadeVector.0* [[TMP0]], i64 undef, i32 1
22 ; O1-NEXT: [[TMP1:%.*]] = load i32, i32* [[SIZE4_I]], align 8, !tbaa [[TBAA6:![0-9]+]]
23 ; O1-NEXT: [[CMP510_NOT_I:%.*]] = icmp eq i32 [[TMP1]], 0
24 ; O1-NEXT: br i1 [[CMP510_NOT_I]], label [[_ZN12FLOATVECPAIR6VECINCEV_EXIT:%.*]], label [[FOR_BODY7_LR_PH_I:%.*]]
25 ; O1: for.body7.lr.ph.i:
26 ; O1-NEXT: [[BASE_I4_I:%.*]] = getelementptr inbounds [[CLASS_HOMEMADEVECTOR_0]], %class.HomemadeVector.0* [[TMP0]], i64 undef, i32 0
27 ; O1-NEXT: [[TMP2:%.*]] = load float*, float** [[BASE_I4_I]], align 8, !tbaa [[TBAA8:![0-9]+]]
28 ; O1-NEXT: [[ARRAYIDX_I5_I:%.*]] = getelementptr inbounds float, float* [[TMP2]], i64 undef
29 ; O1-NEXT: [[BASE_I6_I:%.*]] = getelementptr inbounds [[CLASS_FLOATVECPAIR]], %class.FloatVecPair* [[FVP]], i64 0, i32 0, i32 0
30 ; O1-NEXT: [[TMP3:%.*]] = load %class.HomemadeVector.0*, %class.HomemadeVector.0** [[BASE_I6_I]], align 8, !tbaa [[TBAA0]]
31 ; O1-NEXT: [[BASE_I8_I:%.*]] = getelementptr inbounds [[CLASS_HOMEMADEVECTOR_0]], %class.HomemadeVector.0* [[TMP3]], i64 undef, i32 0
32 ; O1-NEXT: [[TMP4:%.*]] = load float*, float** [[BASE_I8_I]], align 8, !tbaa [[TBAA8]]
33 ; O1-NEXT: [[ARRAYIDX_I9_I:%.*]] = getelementptr inbounds float, float* [[TMP4]], i64 undef
34 ; O1-NEXT: br label [[FOR_BODY7_I:%.*]]
36 ; O1-NEXT: [[J_011_I:%.*]] = phi i32 [ 0, [[FOR_BODY7_LR_PH_I]] ], [ [[INC_I:%.*]], [[FOR_BODY7_I]] ]
37 ; O1-NEXT: [[TMP5:%.*]] = load float, float* [[ARRAYIDX_I5_I]], align 4, !tbaa [[TBAA9:![0-9]+]]
38 ; O1-NEXT: [[TMP6:%.*]] = load float, float* [[ARRAYIDX_I9_I]], align 4, !tbaa [[TBAA9]]
39 ; O1-NEXT: [[ADD_I:%.*]] = fadd float [[TMP5]], [[TMP6]]
40 ; O1-NEXT: store float [[ADD_I]], float* [[ARRAYIDX_I9_I]], align 4, !tbaa [[TBAA9]]
41 ; O1-NEXT: [[INC_I]] = add nuw i32 [[J_011_I]], 1
42 ; O1-NEXT: [[EXITCOND_NOT_I:%.*]] = icmp eq i32 [[INC_I]], [[TMP1]]
43 ; O1-NEXT: br i1 [[EXITCOND_NOT_I]], label [[_ZN12FLOATVECPAIR6VECINCEV_EXIT]], label [[FOR_BODY7_I]], !llvm.loop [[LOOP11:![0-9]+]]
44 ; O1: _ZN12FloatVecPair6vecIncEv.exit:
47 ; O23-LABEL: define {{[^@]+}}@_Z13vecIncFromPtrP12FloatVecPair
48 ; O23-SAME: (%class.FloatVecPair* nocapture readonly [[FVP:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
50 ; O23-NEXT: [[BASE_I_I:%.*]] = getelementptr inbounds [[CLASS_FLOATVECPAIR:%.*]], %class.FloatVecPair* [[FVP]], i64 0, i32 1, i32 0
51 ; O23-NEXT: [[TMP0:%.*]] = load %class.HomemadeVector.0*, %class.HomemadeVector.0** [[BASE_I_I]], align 8, !tbaa [[TBAA0:![0-9]+]]
52 ; O23-NEXT: [[SIZE4_I:%.*]] = getelementptr inbounds [[CLASS_HOMEMADEVECTOR_0:%.*]], %class.HomemadeVector.0* [[TMP0]], i64 undef, i32 1
53 ; O23-NEXT: [[TMP1:%.*]] = load i32, i32* [[SIZE4_I]], align 8, !tbaa [[TBAA6:![0-9]+]]
54 ; O23-NEXT: [[CMP510_NOT_I:%.*]] = icmp eq i32 [[TMP1]], 0
55 ; O23-NEXT: br i1 [[CMP510_NOT_I]], label [[_ZN12FLOATVECPAIR6VECINCEV_EXIT:%.*]], label [[FOR_BODY7_LR_PH_I:%.*]]
56 ; O23: for.body7.lr.ph.i:
57 ; O23-NEXT: [[BASE_I4_I:%.*]] = getelementptr inbounds [[CLASS_HOMEMADEVECTOR_0]], %class.HomemadeVector.0* [[TMP0]], i64 undef, i32 0
58 ; O23-NEXT: [[TMP2:%.*]] = load float*, float** [[BASE_I4_I]], align 8, !tbaa [[TBAA8:![0-9]+]]
59 ; O23-NEXT: [[ARRAYIDX_I5_I:%.*]] = getelementptr inbounds float, float* [[TMP2]], i64 undef
60 ; O23-NEXT: [[BASE_I6_I:%.*]] = getelementptr inbounds [[CLASS_FLOATVECPAIR]], %class.FloatVecPair* [[FVP]], i64 0, i32 0, i32 0
61 ; O23-NEXT: [[TMP3:%.*]] = load %class.HomemadeVector.0*, %class.HomemadeVector.0** [[BASE_I6_I]], align 8, !tbaa [[TBAA0]]
62 ; O23-NEXT: [[BASE_I8_I:%.*]] = getelementptr inbounds [[CLASS_HOMEMADEVECTOR_0]], %class.HomemadeVector.0* [[TMP3]], i64 undef, i32 0
63 ; O23-NEXT: [[TMP4:%.*]] = load float*, float** [[BASE_I8_I]], align 8, !tbaa [[TBAA8]]
64 ; O23-NEXT: [[ARRAYIDX_I9_I:%.*]] = getelementptr inbounds float, float* [[TMP4]], i64 undef
65 ; O23-NEXT: [[DOTPRE_I:%.*]] = load float, float* [[ARRAYIDX_I9_I]], align 4, !tbaa [[TBAA9:![0-9]+]]
66 ; O23-NEXT: br label [[FOR_BODY7_I:%.*]]
68 ; O23-NEXT: [[TMP5:%.*]] = phi float [ [[DOTPRE_I]], [[FOR_BODY7_LR_PH_I]] ], [ [[ADD_I:%.*]], [[FOR_BODY7_I]] ]
69 ; O23-NEXT: [[J_011_I:%.*]] = phi i32 [ 0, [[FOR_BODY7_LR_PH_I]] ], [ [[INC_I:%.*]], [[FOR_BODY7_I]] ]
70 ; O23-NEXT: [[TMP6:%.*]] = load float, float* [[ARRAYIDX_I5_I]], align 4, !tbaa [[TBAA9]]
71 ; O23-NEXT: [[ADD_I]] = fadd float [[TMP5]], [[TMP6]]
72 ; O23-NEXT: store float [[ADD_I]], float* [[ARRAYIDX_I9_I]], align 4, !tbaa [[TBAA9]]
73 ; O23-NEXT: [[INC_I]] = add nuw i32 [[J_011_I]], 1
74 ; O23-NEXT: [[EXITCOND_NOT_I:%.*]] = icmp eq i32 [[INC_I]], [[TMP1]]
75 ; O23-NEXT: br i1 [[EXITCOND_NOT_I]], label [[_ZN12FLOATVECPAIR6VECINCEV_EXIT]], label [[FOR_BODY7_I]], !llvm.loop [[LOOP11:![0-9]+]]
76 ; O23: _ZN12FloatVecPair6vecIncEv.exit:
80 %FVP.addr = alloca %class.FloatVecPair*, align 8
81 store %class.FloatVecPair* %FVP, %class.FloatVecPair** %FVP.addr, align 8, !tbaa !0
82 %0 = load %class.FloatVecPair*, %class.FloatVecPair** %FVP.addr, align 8, !tbaa !0
83 call void @_ZN12FloatVecPair6vecIncEv(%class.FloatVecPair* %0)
87 define linkonce_odr dso_local void @_ZN12FloatVecPair6vecIncEv(%class.FloatVecPair* %this) comdat align 2 {
89 %this.addr = alloca %class.FloatVecPair*, align 8
90 %j = alloca i32, align 4
91 store %class.FloatVecPair* %this, %class.FloatVecPair** %this.addr, align 8, !tbaa !0
92 %this1 = load %class.FloatVecPair*, %class.FloatVecPair** %this.addr, align 8
95 for.cond: ; preds = %entry
98 for.body: ; preds = %for.cond
99 store i32 0, i32* %j, align 4, !tbaa !4
102 for.cond2: ; preds = %for.inc, %for.body
103 %0 = load i32, i32* %j, align 4, !tbaa !4
104 %Vsrc23 = getelementptr inbounds %class.FloatVecPair, %class.FloatVecPair* %this1, i32 0, i32 1
105 %call = call %class.HomemadeVector.0* @_ZN14HomemadeVectorIS_IfLj8EELj8EEixEj(%class.HomemadeVector* %Vsrc23)
106 %size4 = getelementptr inbounds %class.HomemadeVector.0, %class.HomemadeVector.0* %call, i32 0, i32 1
107 %1 = load i32, i32* %size4, align 8, !tbaa !6
108 %cmp5 = icmp ult i32 %0, %1
109 br i1 %cmp5, label %for.body7, label %for.cond.cleanup6
111 for.cond.cleanup6: ; preds = %for.cond2
114 for.body7: ; preds = %for.cond2
115 %Vsrc28 = getelementptr inbounds %class.FloatVecPair, %class.FloatVecPair* %this1, i32 0, i32 1
116 %call9 = call %class.HomemadeVector.0* @_ZN14HomemadeVectorIS_IfLj8EELj8EEixEj(%class.HomemadeVector* %Vsrc28)
117 %call10 = call float* @_ZN14HomemadeVectorIfLj8EEixEj(%class.HomemadeVector.0* %call9)
118 %2 = load float, float* %call10, align 4, !tbaa !8
119 %Vsrcdst = getelementptr inbounds %class.FloatVecPair, %class.FloatVecPair* %this1, i32 0, i32 0
120 %call11 = call %class.HomemadeVector.0* @_ZN14HomemadeVectorIS_IfLj8EELj8EEixEj(%class.HomemadeVector* %Vsrcdst)
121 %call12 = call float* @_ZN14HomemadeVectorIfLj8EEixEj(%class.HomemadeVector.0* %call11)
122 %3 = load float, float* %call12, align 4, !tbaa !8
123 %add = fadd float %3, %2
124 store float %add, float* %call12, align 4, !tbaa !8
127 for.inc: ; preds = %for.body7
128 %4 = load i32, i32* %j, align 4, !tbaa !4
130 store i32 %inc, i32* %j, align 4, !tbaa !4
131 br label %for.cond2, !llvm.loop !10
134 define linkonce_odr dso_local %class.HomemadeVector.0* @_ZN14HomemadeVectorIS_IfLj8EELj8EEixEj(%class.HomemadeVector* %this) align 2 {
136 %this.addr = alloca %class.HomemadeVector*, align 8
137 store %class.HomemadeVector* %this, %class.HomemadeVector** %this.addr, align 8, !tbaa !0
138 %this1 = load %class.HomemadeVector*, %class.HomemadeVector** %this.addr, align 8
139 %base = getelementptr inbounds %class.HomemadeVector, %class.HomemadeVector* %this1, i32 0, i32 0
140 %0 = load %class.HomemadeVector.0*, %class.HomemadeVector.0** %base, align 8, !tbaa !12
141 %1 = bitcast %class.HomemadeVector.0* %0 to i8*
142 %2 = bitcast i8* %1 to %class.HomemadeVector.0*
143 %arrayidx = getelementptr inbounds %class.HomemadeVector.0, %class.HomemadeVector.0* %2, i64 undef
144 ret %class.HomemadeVector.0* %arrayidx
147 define linkonce_odr dso_local float* @_ZN14HomemadeVectorIfLj8EEixEj(%class.HomemadeVector.0* %this) align 2 {
149 %this.addr = alloca %class.HomemadeVector.0*, align 8
150 store %class.HomemadeVector.0* %this, %class.HomemadeVector.0** %this.addr, align 8, !tbaa !0
151 %this1 = load %class.HomemadeVector.0*, %class.HomemadeVector.0** %this.addr, align 8
152 %base = getelementptr inbounds %class.HomemadeVector.0, %class.HomemadeVector.0* %this1, i32 0, i32 0
153 %0 = load float*, float** %base, align 8, !tbaa !14
154 %1 = bitcast float* %0 to i8*
155 %2 = bitcast i8* %1 to float*
156 %arrayidx = getelementptr inbounds float, float* %2, i64 undef
160 !0 = !{!1, !1, i64 0}
161 !1 = !{!"any pointer", !2, i64 0}
162 !2 = !{!"omnipotent char", !3, i64 0}
163 !3 = !{!"Simple C++ TBAA"}
164 !4 = !{!5, !5, i64 0}
165 !5 = !{!"int", !2, i64 0}
166 !6 = !{!7, !5, i64 8}
167 !7 = !{!"_ZTS14HomemadeVectorIfLj8EE", !1, i64 0, !5, i64 8}
168 !8 = !{!9, !9, i64 0}
169 !9 = !{!"float", !2, i64 0}
170 !10 = distinct !{!10, !11}
171 !11 = !{!"llvm.loop.mustprogress"}
172 !12 = !{!13, !1, i64 0}
173 !13 = !{!"_ZTS14HomemadeVectorIS_IfLj8EELj8EE", !1, i64 0, !5, i64 8}
174 !14 = !{!7, !1, i64 0}