Skip to content

Commit

Permalink
#1773: Remove copies of parameter values only if the types match exac…
Browse files Browse the repository at this point in the history
…tly.
  • Loading branch information
siegfriedpammer committed Nov 1, 2019
1 parent 413c9eb commit 77385d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -385,5 +385,11 @@ public static Func<TCaptured> CapturedTypeParameter2<TNonCaptured, TCaptured>(TN
return captured.FirstOrDefault();
};
}

public static Func<int> Issue1773(short data)
{
int integerData = data;
return () => integerData;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ protected internal override void VisitStObj(StObj inst)
} else {
// This is an uninitialized variable:
ILInstruction value;
if (inst.Value.MatchLdLoc(out var v) && v.Kind == VariableKind.Parameter && currentFunction == v.Function) {
if (inst.Value.MatchLdLoc(out var v) && v.Kind == VariableKind.Parameter && currentFunction == v.Function && v.Type.Equals(fieldType)) {
// Special case for parameters: remove copies of parameter values.
instructionsToRemove.Add(inst);
value = inst.Value;
Expand Down

0 comments on commit 77385d4

Please sign in to comment.