We need to keep the layering to a minimum. We already have a layer that is meant to help you generate low-level IR, and that's called FTL::Output. So, anytime we are tempted to add helpers that generate B3 IR on behalf of a client, we should just put that into FTL::Output. Also, anytime you create a helper that generates IR that consists of multiple basic blocks, you need to be mindful of where you insert those blocks. It's not good to just put them at the end of the procedure, since that breaks any range-based analyses. It also makes IR hard to read. This is why FTL::Output has all of this functionality about "inserting blocks before". So, in its current form, the API in B3MathExtras.h is suboptimal and produces weird-looking IR, and to fix that we would need to endow it with FTL::Output's smarts. Seems better to just move it to FTL::Output.
As I wrote in the ChangeLog, that was about easier testing and perf work. Point taken for the poor block layout though. I should definitely fix that.
(In reply to comment #1) > As I wrote in the ChangeLog, that was about easier testing and perf work. > > Point taken for the poor block layout though. I should definitely fix that. It would be great if FTL::Output was moved to B3, and became the default way to build B3 IR. Then our tests could use it. I think you can already instantiate FTL::Output from testb3, so we could start moving in that direction now.