mirror of
https://github.com/apple/swift.git
synced 2026-10-26 20:15:53 +01:00
A direct field offset global of a class with a runtime-computed layout is zero until the class metadata is initialized by the metadata accessor. But the accessor call is marked as readnone and swift_allocObject is NoModRef in SwiftAA. Therefore GVN's load PRE could move a load of the field offset global above the accessor call and the allocation, which resulted in a field offset of zero for the first allocated instance, overwriting the isa pointer. Fix this by treating swift_allocObject as a write of non-constant field offset globals: if an instance of the class exists, the metadata is guaranteed to be initialized. rdar://190169393