The same specific function will (eventually) be emitted as part of
lowering multiple different source files, so don't give them unique
external linkage.
`IRBuilderBase::SetInsertPoint` weirdly replaces our debug location with
one copied from the new insertion point, so undo its damage after
calling it.
Also included: a couple of cleanups I made while tracking this down.