mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #4818 from swiftix/assorted-fixes-3
This commit is contained in:
@@ -66,16 +66,22 @@ bool FunctionEffects::mergeFrom(const FunctionEffects &RHS) {
|
||||
|
||||
bool FunctionEffects::mergeFromApply(
|
||||
const FunctionEffects &ApplyEffects, FullApplySite FAS) {
|
||||
return mergeFromApply(ApplyEffects, FAS.getInstruction());
|
||||
}
|
||||
|
||||
bool FunctionEffects::mergeFromApply(
|
||||
const FunctionEffects &ApplyEffects, SILInstruction *AS) {
|
||||
bool Changed = mergeFlags(ApplyEffects);
|
||||
Changed |= GlobalEffects.mergeFrom(ApplyEffects.GlobalEffects);
|
||||
unsigned numCallerArgs = FAS.getNumArguments();
|
||||
auto FAS = FullApplySite::isa(AS);
|
||||
unsigned numCallerArgs = FAS ? FAS.getNumArguments() : 1;
|
||||
unsigned numCalleeArgs = ApplyEffects.ParamEffects.size();
|
||||
assert(numCalleeArgs >= numCallerArgs);
|
||||
for (unsigned Idx = 0; Idx < numCalleeArgs; Idx++) {
|
||||
// Map the callee argument effects to parameters of this function.
|
||||
// If there are more callee parameters than arguments it means that the
|
||||
// callee is the result of a partial_apply.
|
||||
Effects *E = (Idx < numCallerArgs ? getEffectsOn(FAS.getArgument(Idx)) :
|
||||
Effects *E = (Idx < numCallerArgs ? getEffectsOn(FAS ? FAS.getArgument(Idx) : AS->getOperand(Idx)) :
|
||||
&GlobalEffects);
|
||||
Changed |= E->mergeFrom(ApplyEffects.ParamEffects[Idx]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user