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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed May 29 04:29:06 PDT 2024


nikic wrote:

> > 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?

I don't think we should force the use of IRBuilder *everywhere*, but I do think that a lot of the code currently doing manual instruction insertion would benefit from using IRBuilder instead. The remainder can still use the explicit insertion methods. But I don't really have a good handle on just how commonly used the create-and-insert overloads currently are (you probably have a better idea, as you did some mass changes in that area...)

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


More information about the llvm-commits mailing list