Small cleanup to pruneVisit functions

Instead of walking all ASTs and filtering for SymExprs or DefExprs, collect
SymExprs or DefExpers and walk over them directly.  Also replaced some Vecs
with std::vectors.

Tested on standard configuration.