Skip to content

Commit

Permalink
Constraining the optimization to reduce an assignment to only those t…
Browse files Browse the repository at this point in the history
…hat are based on dup variables
  • Loading branch information
Frank Laub committed Feb 26, 2010
1 parent c0ec180 commit 0d1006b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/DotWeb.Decompiler/Core/Interpreter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,11 @@ private void IsInstance(Instruction il) {
private void AddAssignment(CodeExpression lhs, CodeExpression rhs) {
var last = this.block.Statements.LastOrDefault();
var lastAssignment = last as CodeAssignStatement;
if (lastAssignment != null && lastAssignment.Left == rhs) {
var variableRef = rhs as CodeVariableReference;
if (lastAssignment != null &&
variableRef != null &&
variableRef.Variable.Name.StartsWith("D_") &&
lastAssignment.Left == variableRef) {
// var D_0 = y;
// var x = D_0;
// ->
Expand Down

0 comments on commit 0d1006b

Please sign in to comment.