pub isize_ty: &'ll Type,
/// Cache for the mapping from source index to llvm index for struct fields,
- /// necessary because the mapping depends on padding and thus depens on
- /// TyAndLayout.
+ /// only present if synthetic fields are inserted for padding.
pub field_projection_cache: RefCell<FxHashMap<TyAndLayout<'tcx>, Vec<u32>>>,
pub coverage_cx: Option<coverageinfo::CrateCoverageContext<'ll, 'tcx>>,
FieldsShape::Array { .. } => index as u64,
+ // Look up llvm field index in projection cache if present. If no projection cache
+ // is present no padding is used and the llvm field index matches the memory index.
FieldsShape::Arbitrary { .. } => match cx.field_projection_cache.borrow().get(self) {
Some(projection) => projection[index] as u64,
None => self.fields.memory_index(index) as u64,