Refactor some code to use the IRBuilder.