[AutoDiff] Unify forward- and reverse-mode activity analysis. (#27358)
- Unify handling of `apply` direct results.
- Create `forEachApplyDirectResult` helper for iterating over `apply` direct
results, with special logic for handling `destructure_tuple` users.
This replaces `collectAllExtractedElements`, which required inefficient
allocation.
- Remove `collectAllActualResultsInTypeOrder` "indirect results" argument,
which always comes from the `ApplyInst` argument.
- Unify forward- and reverse-mode activity analysis.
- Remove `AutoDiffAssociatedFunctionKind` from `DifferentiableActivityInfo`.
- TF-813: verify that enabling forward-mode does not affect reverse-mode.
- Miscellaneous gardening.
Resolves TF-800 and TF-813.
The remaining differences between forward- and reverse-mode are expected.