[llvm] [IR] Remove IRBuilder AddMetadataToInst (PR #202280)
Alexis Engelke via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 9 09:16:36 PDT 2026
================
@@ -32758,8 +32758,12 @@ X86TargetLowering::shouldExpandLogicAtomicRMWInIR(
}
void X86TargetLowering::emitBitTestAtomicRMWIntrinsic(AtomicRMWInst *AI) const {
- IRBuilder<> Builder(AI);
- Builder.CollectMetadataToCopy(AI, {LLVMContext::MD_pcsections});
+ LLVMContext &Ctx = AI->getContext();
+ IRBuilder<ConstantFolder, IRBuilderCallbackInserter> Builder(
+ Ctx, ConstantFolder{}, IRBuilderCallbackInserter([&AI](Instruction *I) {
+ I->copyMetadata(*AI, LLVMContext::MD_pcsections);
+ }));
----------------
aengelke wrote:
A separate function to construct an IRBuilder is not possible, because IRBuilder is unmovable. A new IRBuilder subclass seems overkill here and a new inserter won't reduce the amount of code, just add more complexity. (Not sure if you had any particular way in mind?)
https://github.com/llvm/llvm-project/pull/202280
More information about the llvm-commits
mailing list