From 4e93b16f3fce467b2bbda4e5fd8b15fcad2bea93 Mon Sep 17 00:00:00 2001 From: Sergei Barannikov Date: Fri, 2 Aug 2024 16:45:50 +0300 Subject: [PATCH] [llvm] Make InstSimplifyFolder constructor explicit (NFC) (#101654) --- llvm/include/llvm/Analysis/InstSimplifyFolder.h | 2 +- llvm/lib/CodeGen/AtomicExpandPass.cpp | 2 +- llvm/lib/Target/RISCV/RISCVGatherScatterLowering.cpp | 2 +- llvm/lib/Transforms/Utils/LoopUtils.cpp | 6 ++---- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/llvm/include/llvm/Analysis/InstSimplifyFolder.h b/llvm/include/llvm/Analysis/InstSimplifyFolder.h index 6b3da534631a86..430c3edc2f0dc7 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 ebcf76175a36ba..49836b914784fc 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 881be28bfe79ea..06e7110280b9a1 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 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 0abf6d77496dcd..f1f2d522f1cbaa 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 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 GetVF, unsigned IC) { LLVMContext &Ctx = Loc->getContext(); - IRBuilder ChkBuilder(Ctx, - Loc->getDataLayout()); + IRBuilder ChkBuilder(Ctx, InstSimplifyFolder(Loc->getDataLayout())); ChkBuilder.SetInsertPoint(Loc); // Our instructions might fold to a constant. Value *MemoryRuntimeCheck = nullptr;