OpaqueValues: fix emitDistributedActorSystemWitnessCall

This code was not consulting SILFunctionConventions, so it was
passing things indirect when they are not in sil-opaque-values.

This fixes callers as well to ensure they pass arguments and
results correctly in both modes.
This commit is contained in:
Kavon Farvardin
2025-11-18 17:05:10 -08:00
parent 199156b307
commit 7c6d54efa6
6 changed files with 134 additions and 86 deletions

View File

@@ -15,6 +15,7 @@
#include "swift/AST/Decl.h"
#include "llvm/ADT/ArrayRef.h"
#include "swift/SIL/SILValue.h"
#include <optional>
#include <utility>
@@ -30,7 +31,6 @@ class SILArgument;
class SILFunction;
class SILLocation;
class SILType;
class SILValue;
/// Creates a reference to the distributed actor's \p actorSystem
/// stored property.
@@ -46,11 +46,16 @@ SILValue refDistributedActorSystem(SILBuilder &B,
/// \param actorType If non-empty, the type of the distributed actor that is
/// provided as one of the arguments.
/// \param args The arguments provided to the call, not including the base.
/// \param indirectResult If the result is known to be returned indirect,
/// this is the temporary storage for it.
/// \param tryTargets For a call that can throw, the normal and error basic
/// blocks that the call will branch to.
void emitDistributedActorSystemWitnessCall(
/// \returns If the apply result is known to be returned directly,
/// and there are no tryTargets, then the result is returned.
std::optional<SILValue> emitDistributedActorSystemWitnessCall(
SILBuilder &B, SILLocation loc, DeclName methodName, SILValue base,
SILType actorType, llvm::ArrayRef<SILValue> args,
std::optional<SILValue> indirectResult = std::nullopt,
std::optional<std::pair<SILBasicBlock *, SILBasicBlock *>> tryTargets =
std::nullopt);