I wouldn't expect the compiler to drop vars, but it may.
However if I for example make a class that can load something (let's say a picture), and write 20 different procedures to load an image, but I'm only using one of those procedures in an application (but may use an other procedure in an other app) it would simply be a waste of space to compile the remaining 19 procedures. I would expect my compiler to be smart enough to see through my code and only compile what is needed.