@@ -71,9 +71,10 @@ struct OwnershipFixupContext {
7171 // / and use this to seed that new lifetime.
7272 SmallVector<Operand *, 8 > allAddressUsesFromOldValue;
7373
74- // / This is the interior pointer operand that the new value we want to RAUW
75- // / is transitively derived from and enables us to know the underlying
76- // / borrowed base value that we need to lifetime extend.
74+ // / This is the interior pointer (e.g. ref_element_addr)
75+ // / that the new value we want to RAUW is transitively derived from and
76+ // / enables us to know the underlying borrowed base value that we need to
77+ // / lifetime extend.
7778 // /
7879 // / This is only initialized when the interior pointer has uses that must be
7980 // / replaced.
@@ -149,9 +150,15 @@ class OwnershipRAUWHelper {
149150 operator bool () const { return isValid (); }
150151 bool isValid () const { return bool (ctx) && bool (oldValue) && bool (newValue); }
151152
152- // / Perform the actual RAUW. We require that \p newValue and \p oldValue have
153- // / the same type at this point (in contrast to when calling
154- // / OwnershipRAUWFixupHelper::get()).
153+ // / True if replacement requires copying the original instruction's source
154+ // / operand, creating a new borrow scope for that copy, then cloning the
155+ // / original.
156+ bool requiresCopyBorrowAndClone () const {
157+ return ctx->extraAddressFixupInfo .base ;
158+ }
159+
160+ // / Perform OSSA fixup on newValue and return a fixed-up value based that can
161+ // / be used to replace all uses of oldValue.
155162 // /
156163 // / This is so that we can avoid creating "forwarding" transformation
157164 // / instructions before we know if we can perform the RAUW. Any such
0 commit comments