[moveOnly] Implement a new _copy function that performs an explicit copy value.

The key thing is that the move checker will not consider the explicit copy value
to be a copy_value that can be rewritten, ensuring that any uses of the result
of the explicit copy_value (consuming or other wise) are not checked.

Similar to the _move operator I recently introduced, this is a transparent
function so we can perform one level of specialization and thus at least be
generic over all concrete types.
This commit is contained in:
Michael Gottesman
2021-10-28 22:02:31 -07:00
parent 94d824af9d
commit f9122a79b7
31 changed files with 360 additions and 3 deletions

View File

@@ -2191,9 +2191,9 @@ static void visitBuiltinAddress(BuiltinInst *builtin,
visitor(&builtin->getAllOperands()[2]);
return;
// This consumes its second parameter (the arg) and takes/places that value
// into the first parameter (the result).
// These effect both operands.
case BuiltinValueKind::Move:
case BuiltinValueKind::Copy:
visitor(&builtin->getAllOperands()[1]);
return;