   // the struct is equivalent to a ref count operation on the extracted
   // member. Strip off the extract.
   case let sei as StructExtractInst where sei.isFieldOnlyNonTrivialField:
-    return sei.operands[0].value
-
-  // If we have a struct instruction with only one non-trivial stored field, the
-  // only reference count that can be modified is the non-trivial field. Return
-  // the non-trivial field.
-  case let si as StructInst:
-    return si.uniqueNonTrivialOperand
+    return sei.operand
+
+  // If we have a struct or tuple instruction with only one non-trivial operand, the
+  // only reference count that can be modified is the non-trivial operand. Return
+  // the non-trivial operand.
+  case is StructInst, is TupleInst:
+    return inst.uniqueNonTrivialOperand
 
   // If we have an enum instruction with a payload, strip off the enum to
   // expose the enum's payload.
   case let ei as EnumInst where !ei.operands.isEmpty:
-    return ei.operands[0].value
+    return ei.operand
 
   // If we have a tuple_extract that is extracting the only non trivial member
   // of a tuple, a retain_value on the tuple is equivalent to a retain_value on
   // the extracted value.
   case let tei as TupleExtractInst where tei.isEltOnlyNonTrivialElt:
-    return tei.operands[0].value
-
-  // If we are forming a tuple and the tuple only has one element with reference
-  // semantics, a retain_value on the tuple is equivalent to a retain value on
-  // the tuple operand.
-  case let ti as TupleInst:
-    return ti.uniqueNonTrivialOperand
+    return tei.operand
 
   default:
     return nil

}

private func stripRCIdentityPreservingInsts(_ value: Value) -> Value? {
  switch value {
  // First strip off RC identity preserving casts.
  case let inst as Instruction where inst is UpcastInst ||
    inst is UncheckedRefCastInst ||
    inst is InitExistentialRefInst ||
    inst is OpenExistentialRefInst ||
    inst is RefToBridgeObjectInst ||
    inst is BridgeObjectToRefInst ||
    inst is ConvertFunctionInst ||
    inst is UncheckedEnumDataInst:
    return inst.operands[0].value

  // Then if we have a struct_extract that is extracting a non-trivial member

    var candidateElt: Value?
    let function = self.function

    for op in operands {
      if !op.value.type.isTrivial(in: function) {
        if candidateElt == nil {
          candidateElt = op.value
          continue
