Add support to insert trace code as an "optimization"