@@ -254,14 +254,11 @@ bool ElementUseCollector::collectUses(SILValue Pointer) {
254
254
255
255
// Coming out of SILGen, we assume that raw stores are initializations,
256
256
// unless they have trivial type (which we classify as InitOrAssign).
257
- PMOUseKind Kind;
258
- if (InStructSubElement)
259
- Kind = PMOUseKind::PartialStore;
260
- else if (PointeeType.isTrivial (User->getModule ()))
261
- Kind = PMOUseKind::InitOrAssign;
262
- else
263
- Kind = PMOUseKind::Initialization;
264
-
257
+ auto Kind = ([&]() -> PMOUseKind {
258
+ if (PointeeType.isTrivial (User->getModule ()))
259
+ return PMOUseKind::InitOrAssign;
260
+ return PMOUseKind::Initialization;
261
+ })();
265
262
Uses.emplace_back (User, Kind);
266
263
continue ;
267
264
}
@@ -270,9 +267,7 @@ bool ElementUseCollector::collectUses(SILValue Pointer) {
270
267
if (auto *SI = dyn_cast<Store##Name##Inst>(User)) { \
271
268
if (UI->getOperandNumber () == 1 ) { \
272
269
PMOUseKind Kind; \
273
- if (InStructSubElement) \
274
- Kind = PMOUseKind::PartialStore; \
275
- else if (SI->isInitializationOfDest ()) \
270
+ if (SI->isInitializationOfDest ()) \
276
271
Kind = PMOUseKind::Initialization; \
277
272
else \
278
273
Kind = PMOUseKind::Assign; \
@@ -294,16 +289,15 @@ bool ElementUseCollector::collectUses(SILValue Pointer) {
294
289
// the destination, then this is an unknown assignment. Note that we'll
295
290
// revisit this instruction and add it to Uses twice if it is both a load
296
291
// and store to the same aggregate.
297
- PMOUseKind Kind;
298
- if (UI->getOperandNumber () == 0 )
299
- Kind = PMOUseKind::Load;
300
- else if (InStructSubElement)
301
- Kind = PMOUseKind::PartialStore;
302
- else if (CAI->isInitializationOfDest ())
303
- Kind = PMOUseKind::Initialization;
304
- else
305
- Kind = PMOUseKind::Assign;
306
-
292
+ //
293
+ // Inline constructor.
294
+ auto Kind = ([&]() -> PMOUseKind {
295
+ if (UI->getOperandNumber () == CopyAddrInst::Src)
296
+ return PMOUseKind::Load;
297
+ if (CAI->isInitializationOfDest ())
298
+ return PMOUseKind::Initialization;
299
+ return PMOUseKind::Assign;
300
+ })();
307
301
Uses.emplace_back (User, Kind);
308
302
continue ;
309
303
}
0 commit comments