compiler: add an option to emit optimization diagnostics