@@ -16,6 +16,7 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
16
16
; CHECK: @[[A1:[a-zA-Z0-9_$"\\.-]+]] = common global i8 0, align 8
17
17
; CHECK: @[[A2:[a-zA-Z0-9_$"\\.-]+]] = common global i8 0, align 16
18
18
; CHECK: @[[CND:[a-zA-Z0-9_$"\\.-]+]] = external global i1
19
+ ; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = global i8 0, align 32
19
20
;.
20
21
define i32* @test1 (i32* align 8 %0 ) #0 {
21
22
; CHECK: Function Attrs: nofree noinline norecurse nosync nounwind readnone willreturn uwtable
@@ -1114,6 +1115,75 @@ define void @align4_caller(i8* %p) {
1114
1115
1115
1116
declare void @align4_callee (i8* align (4 ) %p )
1116
1117
1118
+ @G = global i8 0 , align 32
1119
+
1120
+ define internal i8* @aligned_8_return (i8* %a , i1 %c1 , i1 %c2 ) norecurse {
1121
+ ; NOT_CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1122
+ ; NOT_CGSCC_OPM-LABEL: define {{[^@]+}}@aligned_8_return
1123
+ ; NOT_CGSCC_OPM-SAME: (i8* noalias nofree readnone align 16 "no-capture-maybe-returned" [[A:%.*]], i1 [[C1:%.*]], i1 [[C2:%.*]]) #[[ATTR9]] {
1124
+ ; NOT_CGSCC_OPM-NEXT: [[STACK:%.*]] = alloca i8*, align 8
1125
+ ; NOT_CGSCC_OPM-NEXT: br i1 [[C1]], label [[T:%.*]], label [[F:%.*]]
1126
+ ; NOT_CGSCC_OPM: t:
1127
+ ; NOT_CGSCC_OPM-NEXT: [[GEP:%.*]] = getelementptr i8, i8* @G, i32 8
1128
+ ; NOT_CGSCC_OPM-NEXT: [[SEL:%.*]] = select i1 [[C2]], i8* [[A]], i8* [[GEP]]
1129
+ ; NOT_CGSCC_OPM-NEXT: store i8* [[SEL]], i8** [[STACK]], align 8
1130
+ ; NOT_CGSCC_OPM-NEXT: br label [[END:%.*]]
1131
+ ; NOT_CGSCC_OPM: f:
1132
+ ; NOT_CGSCC_OPM-NEXT: store i8* @G, i8** [[STACK]], align 8
1133
+ ; NOT_CGSCC_OPM-NEXT: br label [[END]]
1134
+ ; NOT_CGSCC_OPM: end:
1135
+ ; NOT_CGSCC_OPM-NEXT: [[L:%.*]] = load i8*, i8** [[STACK]], align 8
1136
+ ; NOT_CGSCC_OPM-NEXT: ret i8* [[L]]
1137
+ ;
1138
+ ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1139
+ ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@aligned_8_return
1140
+ ; IS__CGSCC_OPM-SAME: (i8* noalias nofree readnone align 16 "no-capture-maybe-returned" [[A:%.*]], i1 [[C1:%.*]], i1 [[C2:%.*]]) #[[ATTR10]] {
1141
+ ; IS__CGSCC_OPM-NEXT: [[STACK:%.*]] = alloca i8*, align 8
1142
+ ; IS__CGSCC_OPM-NEXT: br i1 [[C1]], label [[T:%.*]], label [[F:%.*]]
1143
+ ; IS__CGSCC_OPM: t:
1144
+ ; IS__CGSCC_OPM-NEXT: [[GEP:%.*]] = getelementptr i8, i8* @G, i32 8
1145
+ ; IS__CGSCC_OPM-NEXT: [[SEL:%.*]] = select i1 [[C2]], i8* [[A]], i8* [[GEP]]
1146
+ ; IS__CGSCC_OPM-NEXT: store i8* [[SEL]], i8** [[STACK]], align 8
1147
+ ; IS__CGSCC_OPM-NEXT: br label [[END:%.*]]
1148
+ ; IS__CGSCC_OPM: f:
1149
+ ; IS__CGSCC_OPM-NEXT: store i8* @G, i8** [[STACK]], align 8
1150
+ ; IS__CGSCC_OPM-NEXT: br label [[END]]
1151
+ ; IS__CGSCC_OPM: end:
1152
+ ; IS__CGSCC_OPM-NEXT: [[L:%.*]] = load i8*, i8** [[STACK]], align 8
1153
+ ; IS__CGSCC_OPM-NEXT: ret i8* [[L]]
1154
+ ;
1155
+ %stack = alloca i8*
1156
+ br i1 %c1 , label %t , label %f
1157
+ t:
1158
+ %gep = getelementptr i8 , i8* @G , i32 8
1159
+ %sel = select i1 %c2 , i8* %a , i8* %gep
1160
+ store i8* %sel , i8** %stack
1161
+ br label %end
1162
+ f:
1163
+ store i8* @G , i8** %stack
1164
+ br label %end
1165
+ end:
1166
+ %l = load i8* , i8** %stack
1167
+ ret i8* %l
1168
+ }
1169
+
1170
+ define i8* @aligned_8_return_caller (i8* align (16 ) %a , i1 %c1 , i1 %c2 ) {
1171
+ ; NOT_CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1172
+ ; NOT_CGSCC_OPM-LABEL: define {{[^@]+}}@aligned_8_return_caller
1173
+ ; NOT_CGSCC_OPM-SAME: (i8* nofree readnone align 16 "no-capture-maybe-returned" [[A:%.*]], i1 [[C1:%.*]], i1 [[C2:%.*]]) #[[ATTR9]] {
1174
+ ; NOT_CGSCC_OPM-NEXT: [[R:%.*]] = call i8* @aligned_8_return(i8* noalias nofree readnone align 16 "no-capture-maybe-returned" [[A]], i1 [[C1]], i1 [[C2]]) #[[ATTR12:[0-9]+]]
1175
+ ; NOT_CGSCC_OPM-NEXT: ret i8* [[R]]
1176
+ ;
1177
+ ; IS__CGSCC_OPM: Function Attrs: nofree norecurse nosync nounwind readnone willreturn
1178
+ ; IS__CGSCC_OPM-LABEL: define {{[^@]+}}@aligned_8_return_caller
1179
+ ; IS__CGSCC_OPM-SAME: (i8* nofree readnone align 16 "no-capture-maybe-returned" [[A:%.*]], i1 [[C1:%.*]], i1 [[C2:%.*]]) #[[ATTR10]] {
1180
+ ; IS__CGSCC_OPM-NEXT: [[R:%.*]] = call i8* @aligned_8_return(i8* noalias nofree readnone align 16 "no-capture-maybe-returned" [[A]], i1 [[C1]], i1 [[C2]]) #[[ATTR13:[0-9]+]]
1181
+ ; IS__CGSCC_OPM-NEXT: ret i8* [[R]]
1182
+ ;
1183
+ %r = call i8* @aligned_8_return (i8* %a , i1 %c1 , i1 %c2 )
1184
+ ret i8* %r
1185
+ }
1186
+
1117
1187
attributes #0 = { nounwind uwtable noinline }
1118
1188
attributes #1 = { uwtable noinline }
1119
1189
attributes #2 = { null_pointer_is_valid }
@@ -1130,6 +1200,7 @@ attributes #2 = { null_pointer_is_valid }
1130
1200
; IS__TUNIT____: attributes #[[ATTR9]] = { nofree norecurse nosync nounwind readnone willreturn }
1131
1201
; IS__TUNIT____: attributes #[[ATTR10]] = { nofree norecurse nosync nounwind readonly willreturn }
1132
1202
; IS__TUNIT____: attributes #[[ATTR11]] = { nofree nosync nounwind readonly willreturn }
1203
+ ; IS__TUNIT____: attributes #[[ATTR12]] = { nofree nosync nounwind readnone willreturn }
1133
1204
;.
1134
1205
; IS__CGSCC_OPM: attributes #[[ATTR0]] = { nofree noinline norecurse nosync nounwind readnone willreturn uwtable }
1135
1206
; IS__CGSCC_OPM: attributes #[[ATTR1]] = { nofree noinline nosync nounwind readnone willreturn uwtable }
@@ -1144,6 +1215,7 @@ attributes #2 = { null_pointer_is_valid }
1144
1215
; IS__CGSCC_OPM: attributes #[[ATTR10]] = { nofree norecurse nosync nounwind readnone willreturn }
1145
1216
; IS__CGSCC_OPM: attributes #[[ATTR11]] = { nofree norecurse nosync nounwind readonly willreturn }
1146
1217
; IS__CGSCC_OPM: attributes #[[ATTR12]] = { readonly willreturn }
1218
+ ; IS__CGSCC_OPM: attributes #[[ATTR13]] = { readnone willreturn }
1147
1219
;.
1148
1220
; IS__CGSCC_NPM: attributes #[[ATTR0]] = { nofree noinline norecurse nosync nounwind readnone willreturn uwtable }
1149
1221
; IS__CGSCC_NPM: attributes #[[ATTR1]] = { noinline norecurse nounwind uwtable }
@@ -1157,4 +1229,5 @@ attributes #2 = { null_pointer_is_valid }
1157
1229
; IS__CGSCC_NPM: attributes #[[ATTR9]] = { nofree norecurse nosync nounwind readnone willreturn }
1158
1230
; IS__CGSCC_NPM: attributes #[[ATTR10]] = { nofree norecurse nosync nounwind readonly willreturn }
1159
1231
; IS__CGSCC_NPM: attributes #[[ATTR11]] = { readonly willreturn }
1232
+ ; IS__CGSCC_NPM: attributes #[[ATTR12]] = { readnone willreturn }
1160
1233
;.
0 commit comments