[llvm] [llvm] Make InstSimplifyFolder constructor explicit (NFC) (PR #101654)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 2 04:38:36 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms

@llvm/pr-subscribers-llvm-analysis

Author: Sergei Barannikov (s-barannikov)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/101654.diff


4 Files Affected:

- (modified) llvm/include/llvm/Analysis/InstSimplifyFolder.h (+1-1) 
- (modified) llvm/lib/CodeGen/AtomicExpandPass.cpp (+1-1) 
- (modified) llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp (+1-1) 
- (modified) llvm/lib/Transforms/Utils/LoopUtils.cpp (+2-4) 


``````````diff
diff --git a/llvm/include/llvm/Analysis/InstSimplifyFolder.h b/llvm/include/llvm/Analysis/InstSimplifyFolder.h
index 6b3da534631a8..430c3edc2f0dc 100644
--- a/llvm/include/llvm/Analysis/InstSimplifyFolder.h
+++ b/llvm/include/llvm/Analysis/InstSimplifyFolder.h
@@ -38,7 +38,7 @@ class InstSimplifyFolder final : public IRBuilderFolder {
   virtual void anchor();
 
 public:
-  InstSimplifyFolder(const DataLayout &DL) : ConstFolder(DL), SQ(DL) {}
+  explicit InstSimplifyFolder(const DataLayout &DL) : ConstFolder(DL), SQ(DL) {}
 
   //===--------------------------------------------------------------------===//
   // Value-based folders.
diff --git a/llvm/lib/CodeGen/AtomicExpandPass.cpp b/llvm/lib/CodeGen/AtomicExpandPass.cpp
index ebcf76175a36b..49836b914784f 100644
--- a/llvm/lib/CodeGen/AtomicExpandPass.cpp
+++ b/llvm/lib/CodeGen/AtomicExpandPass.cpp
@@ -142,7 +142,7 @@ struct ReplacementIRBuilder
   // Preserves the DebugLoc from I, and preserves still valid metadata.
   // Enable StrictFP builder mode when appropriate.
   explicit ReplacementIRBuilder(Instruction *I, const DataLayout &DL)
-      : IRBuilder(I->getContext(), DL,
+      : IRBuilder(I->getContext(), InstSimplifyFolder(DL),
                   IRBuilderCallbackInserter(
                       [this](Instruction *I) { addMMRAMD(I); })) {
     SetInsertPoint(I);
diff --git a/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp b/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp
index 881be28bfe79e..06e7110280b9a 100644
--- a/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp
@@ -504,7 +504,7 @@ bool RISCVGatherScatterLowering::tryCreateStridedLoadStore(IntrinsicInst *II,
     return false;
 
   LLVMContext &Ctx = PtrI->getContext();
-  IRBuilder<InstSimplifyFolder> Builder(Ctx, *DL);
+  IRBuilder Builder(Ctx, InstSimplifyFolder(*DL));
   Builder.SetInsertPoint(PtrI);
 
   Value *BasePtr, *Stride;
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp
index 0abf6d77496dc..f1f2d522f1cba 100644
--- a/llvm/lib/Transforms/Utils/LoopUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp
@@ -1901,8 +1901,7 @@ Value *llvm::addRuntimeChecks(
       expandBounds(PointerChecks, TheLoop, Loc, Exp, HoistRuntimeChecks);
 
   LLVMContext &Ctx = Loc->getContext();
-  IRBuilder<InstSimplifyFolder> ChkBuilder(Ctx,
-                                           Loc->getDataLayout());
+  IRBuilder ChkBuilder(Ctx, InstSimplifyFolder(Loc->getDataLayout()));
   ChkBuilder.SetInsertPoint(Loc);
   // Our instructions might fold to a constant.
   Value *MemoryRuntimeCheck = nullptr;
@@ -1955,8 +1954,7 @@ Value *llvm::addDiffRuntimeChecks(
     function_ref<Value *(IRBuilderBase &, unsigned)> GetVF, unsigned IC) {
 
   LLVMContext &Ctx = Loc->getContext();
-  IRBuilder<InstSimplifyFolder> ChkBuilder(Ctx,
-                                           Loc->getDataLayout());
+  IRBuilder ChkBuilder(Ctx, InstSimplifyFolder(Loc->getDataLayout()));
   ChkBuilder.SetInsertPoint(Loc);
   // Our instructions might fold to a constant.
   Value *MemoryRuntimeCheck = nullptr;

``````````

</details>


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


More information about the llvm-commits mailing list