The compiler is generating a LOT of those instructions, usually many of them in a row with different small constants.
Why is it doing that, and how do I make it not do that?
I'm trying to move a large application from version 7.1 of the compiler to version 9.0. The .exe and each .dll is over twice as large when build with 9.0 as it was with 7.1. Performance varies with different tasks, but typically is 30% slower for the 9.0 version than the 7.1 version.
I tried using Vtune to find the problem with the 9.0 built exe, but Vtune always crashes with a buffer overflow at the point you attempt to drill from the .exe into the list of subroutines. (With the 7.1 build, I've seen similar Vtune crashes on occasion, but with the 9.0 build Vtune crashes every time).
I tried generating asm output (/FAcs switch) and examining it to see what is wrong. That is where I see the massive number of instructions that are the topic of this question:
mov DWORD PTR [ebp-4], 0
followed directly by
mov DWORD PTR [ebp-4], 1
mov DWORD PTR [ebp-4], 2
Not always in sequence by value, but usually.
I don't even know for sure that this is a significant part of the 30% slow down I'm trying to fix. But looking around the code it seems to be around half the total generated instructions, so I expect it is a big part of the .exe being over twice as large.