From fdfa0a136def007c7b0e025a70ab3e1493f2e466 Mon Sep 17 00:00:00 2001 From: Sergio Afonso Date: Tue, 10 Sep 2024 10:29:31 +0100 Subject: [PATCH] [OMPIRBuilder] Remove unused functions (NFC) (#156) This patch removes some internal functions from the OMPIRBuilder that are not used and do not exist upstream. They seem to have been left behind after some merge or improvements to reductions support made them redundant. --- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp | 32 ----------------------- 1 file changed, 32 deletions(-) diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp index 3652ef8ab947e3..bdb0326435d569 100644 --- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp +++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp @@ -149,17 +149,6 @@ static bool isValidWorkshareLoopScheduleType(OMPScheduleType SchedType) { } #endif -Function *GLOBAL_ReductionFunc = nullptr; - -static uint64_t getTypeSizeInBytes(Module &M, Type *Type) { - return divideCeil(M.getDataLayout().getTypeSizeInBits(Type), 8); -} - -static Value *getTypeSizeInBytesValue(IRBuilder<> &Builder, Module &M, - Type *Type) { - return Builder.getInt64(getTypeSizeInBytes(M, Type)); -} - static const omp::GV &getGridValue(const Triple &T, Function *Kernel) { if (T.isAMDGPU()) { StringRef Features = @@ -6692,27 +6681,6 @@ emitExecutionMode(OpenMPIRBuilder &OMPBuilder, IRBuilderBase &Builder, LLVMCompilerUsed.emplace_back(GVMode); } -static void replaceConstatExprUsesInFuncWithInstr(ConstantExpr *ConstExpr, - Function *Func) { - for (User *User : make_early_inc_range(ConstExpr->users())) { - if (auto *Instr = dyn_cast(User)) { - if (Instr->getFunction() == Func) { - Instruction *ConstInst = ConstExpr->getAsInstruction(); - ConstInst->insertBefore(*Instr->getParent(), Instr->getIterator()); - Instr->replaceUsesOfWith(ConstExpr, ConstInst); - } - } - } -} - -static void replaceConstantValueUsesInFuncWithInstr(llvm::Value *Input, - Function *Func) { - for (User *User : make_early_inc_range(Input->users())) - if (auto *Const = dyn_cast(User)) - if (auto *ConstExpr = dyn_cast(Const)) - replaceConstatExprUsesInFuncWithInstr(ConstExpr, Func); -} - static Function *createOutlinedFunction( OpenMPIRBuilder &OMPBuilder, IRBuilderBase &Builder, bool IsSPMD, const OpenMPIRBuilder::TargetKernelDefaultBounds &DefaultBounds,