[llvm] f085261 - [IRBuilder] Add additional overload with in-place Inserter construction (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 12 06:29:57 PST 2025


Author: Nikita Popov
Date: 2025-02-12T15:29:47+01:00
New Revision: f085261b59a782ebd602ae1e590242ab70ddf8a4

URL: https://github.com/llvm/llvm-project/commit/f085261b59a782ebd602ae1e590242ab70ddf8a4
DIFF: https://github.com/llvm/llvm-project/commit/f085261b59a782ebd602ae1e590242ab70ddf8a4.diff

LOG: [IRBuilder] Add additional overload with in-place Inserter construction (NFC)

Currently, for IRBuilders that require an explicitly constructed
Folder, we also force Inserter to be constructed and then copied.
Provide a variant where the Inserter uses in-place default
construction, to support cases where it is self-referential.

Added: 
    

Modified: 
    llvm/include/llvm/IR/IRBuilder.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h
index 833c91fd97461..1692f7dfb7fa7 100644
--- a/llvm/include/llvm/IR/IRBuilder.h
+++ b/llvm/include/llvm/IR/IRBuilder.h
@@ -2708,12 +2708,17 @@ class IRBuilder : public IRBuilderBase {
   InserterTy Inserter;
 
 public:
-  IRBuilder(LLVMContext &C, FolderTy Folder, InserterTy Inserter = InserterTy(),
+  IRBuilder(LLVMContext &C, FolderTy Folder, InserterTy Inserter,
             MDNode *FPMathTag = nullptr,
             ArrayRef<OperandBundleDef> OpBundles = {})
       : IRBuilderBase(C, this->Folder, this->Inserter, FPMathTag, OpBundles),
         Folder(Folder), Inserter(Inserter) {}
 
+  IRBuilder(LLVMContext &C, FolderTy Folder, MDNode *FPMathTag = nullptr,
+            ArrayRef<OperandBundleDef> OpBundles = {})
+      : IRBuilderBase(C, this->Folder, this->Inserter, FPMathTag, OpBundles),
+        Folder(Folder) {}
+
   explicit IRBuilder(LLVMContext &C, MDNode *FPMathTag = nullptr,
                      ArrayRef<OperandBundleDef> OpBundles = {})
       : IRBuilderBase(C, this->Folder, this->Inserter, FPMathTag, OpBundles) {}


        


More information about the llvm-commits mailing list