First of all: once code enters testing the only changes to it should be bug fixes as changing anything else could cuase bugs to crop up, so if you're trimming code post testing you have to go through the entire testing stage again.
Secondly: There are two types of testing. Black box testing, which is what people classically think of as testing, where someone is using the program without seeing the source code. This type of testing finds errors that allow bad data through or in some way mishandle data. Then there is clear box testing. This is where another programmer reads your code and looks for things like verbosity, wasted code, functions that are never called and special case handleing.
So to answer the original question, clear box testing would be the stage where this is done. Though in my experience noone code trims anymore, otherwise I wouldn't be installing programms off of 3 - 5 CDs.