[llvm] [IR] Make instr-create fns with Instruction *InsertBefore non-default (PR #86132)

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Wed May 29 04:06:10 PDT 2024


SLTozer wrote:

> I guess this is okay (and I wouldn't want to block this), but this does seem like a good point to reconsider the overall design.

I agree - the reason I took this approach was mainly that it is the softest in terms of API changes - although we eventually need to move people off of inserting at Instructions, the current approach ensures that as little changes underfoot for API users as possible (although we don't guarantee a stable API, previous discussions indicated that since instruction creation has such a large surface area it should be handled delicately).

> Probably option 2 would be ideal, but it's also the option that involves the most work :)

I believe this as well - as you mentioned it has extra advantages which are highly relevant to my interests, as I'm imminently looking to make further changes to instruction creation to better preserve debug locations, and these may be easier to implement if we're creating and inserting instructions through the IRBuilder. My major concern however isn't the amount of work required (though it's not to be underestimated), but the disruption that might be involved. Do you have a sense that forcing a transition to IRBuilder would be reasonable?

https://github.com/llvm/llvm-project/pull/86132


More information about the llvm-commits mailing list