@@ -278,39 +278,38 @@ class device_image_impl {
278
278
Descriptors.size ());
279
279
unsigned LocalOffset = 0 ;
280
280
while (It != End) {
281
+ unsigned int ID = It[0 ];
282
+ unsigned int CompositeOffset = It[1 ];
283
+ unsigned int Size = It[2 ];
284
+
281
285
if (MBinImage->supportsSpecConstants ()) {
282
286
// Make sure that alignment is correct in blob.
283
- const unsigned OffsetFromLast = /* Offset */ It[ 1 ] - LocalOffset;
287
+ const unsigned OffsetFromLast = CompositeOffset - LocalOffset;
284
288
BlobOffset += OffsetFromLast;
285
289
286
- // Composites may have a special padding element at the end which
287
- // should not have a descriptor. These padding elements all have max
288
- // ID value.
289
- if (It[0 ] != std::numeric_limits<std::uint32_t >::max ()) {
290
- // The map is not locked here because updateSpecConstSymMap() is
291
- // only supposed to be called from c'tor.
292
- MSpecConstSymMap[std::string{SCName}].push_back (
293
- SpecConstDescT{/* ID*/ It[0 ], /* CompositeOffset*/ It[1 ],
294
- /* Size*/ It[2 ], BlobOffset});
295
- }
296
-
297
- LocalOffset += OffsetFromLast + /* Size*/ It[2 ];
290
+ LocalOffset += OffsetFromLast + Size;
298
291
} else {
299
292
// For emulated specialization constants the CompositeOffset is used
300
293
// to indicate necessary padding to ensure correct alignment.
301
- BlobOffset += /* CompositeOffset */ It[ 1 ] ;
294
+ BlobOffset += CompositeOffset;
302
295
303
- // The map is not locked here because updateSpecConstSymMap() is
304
- // only supposed to be called from c'tor.
305
296
// Now that we've handled the padding we can set the
306
297
// CompositeOffset to 0, so that emulated and native spec constants
307
298
// can be handled the same going forward.
299
+ CompositeOffset = 0 ;
300
+ }
301
+
302
+ // Composites may have a special padding element at the end which
303
+ // should not have a descriptor. These padding elements all have max
304
+ // ID value.
305
+ if (ID != std::numeric_limits<std::uint32_t >::max ()) {
306
+ // The map is not locked here because updateSpecConstSymMap() is
307
+ // only supposed to be called from c'tor.
308
308
MSpecConstSymMap[std::string{SCName}].push_back (
309
- SpecConstDescT{/* ID*/ It[0 ], /* CompositeOffset*/ 0 ,
310
- /* Size*/ It[2 ], BlobOffset});
309
+ SpecConstDescT{ID, CompositeOffset, Size, BlobOffset});
311
310
}
312
311
313
- BlobOffset += /* Size*/ It[ 2 ] ;
312
+ BlobOffset += Size;
314
313
It += NumElements;
315
314
}
316
315
}
0 commit comments