Nops are removed
This commit is contained in:
parent
28f95d386e
commit
debc4b346a
|
@ -45,15 +45,26 @@ namespace de4dot.blocks.cflow {
|
||||||
var instructions = block.Instructions;
|
var instructions = block.Instructions;
|
||||||
for (int i = 0; i < instructions.Count; i++) {
|
for (int i = 0; i < instructions.Count; i++) {
|
||||||
var instr = instructions[i];
|
var instr = instructions[i];
|
||||||
if (instr.OpCode.Code != Code.Pop)
|
switch (instr.OpCode.Code) {
|
||||||
continue;
|
case Code.Nop:
|
||||||
|
// The NOP is recreated if the block is empty so don't remove it if it's
|
||||||
|
// the only instruction.
|
||||||
|
if (instructions.Count > 1)
|
||||||
|
allDeadInstructions.Add(i);
|
||||||
|
break;
|
||||||
|
|
||||||
instructionExpressionFinder.init(block, false);
|
case Code.Pop:
|
||||||
if (!instructionExpressionFinder.find(i))
|
instructionExpressionFinder.init(block, false);
|
||||||
continue;
|
if (!instructionExpressionFinder.find(i))
|
||||||
if (!okInstructions(block, instructionExpressionFinder.DeadInstructions))
|
continue;
|
||||||
continue;
|
if (!okInstructions(block, instructionExpressionFinder.DeadInstructions))
|
||||||
allDeadInstructions.AddRange(instructionExpressionFinder.DeadInstructions);
|
continue;
|
||||||
|
allDeadInstructions.AddRange(instructionExpressionFinder.DeadInstructions);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
block.remove(allDeadInstructions);
|
block.remove(allDeadInstructions);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user