Apply the same refactoring to irgen.cpp.