This uses changeToCall and changeToInvokeAndSplitBasicBlock from
lib/Transforms/Utils, replacing the custom logic. One difference of
those functions from our previous logic is they delete the original
CallInst/InvokeInst, which makes them tricky to use while iterating
through instructions/BBs. So this CL gathers the candidate calls first
and run them through changeToInvokeAndSplitBasicBlock later.
Also this renames some variables.