From 626e016619e9a62e58cb941b4174dae22e00bd0b Mon Sep 17 00:00:00 2001 From: Abid Qadeer Date: Mon, 11 Aug 2025 19:03:40 +0100 Subject: [PATCH] [OMPIRBuilder] Fix build failure after 151306. A function added in pr#151306 was under NDEBUG macro which caused the build to fail in certain cases. It has been moved out of the #ifdef check to ensure it is always compiled. --- llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp index 5ea8631c0706f..2ac9a0d3fbd66 100644 --- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp +++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp @@ -92,18 +92,6 @@ static bool isConflictIP(IRBuilder<>::InsertPoint IP1, return IP1.getBlock() == IP2.getBlock() && IP1.getPoint() == IP2.getPoint(); } -/// This is wrapper over IRBuilderBase::restoreIP that also restores the current -/// debug location to the last instruction in the specified basic block if the -/// insert point points to the end of the block. -static void restoreIPandDebugLoc(llvm::IRBuilderBase &Builder, - llvm::IRBuilderBase::InsertPoint IP) { - Builder.restoreIP(IP); - llvm::BasicBlock *BB = Builder.GetInsertBlock(); - llvm::BasicBlock::iterator I = Builder.GetInsertPoint(); - if (!BB->empty() && I == BB->end()) - Builder.SetCurrentDebugLocation(BB->back().getStableDebugLoc()); -} - static bool isValidWorkshareLoopScheduleType(OMPScheduleType SchedType) { // Valid ordered/unordered and base algorithm combinations. switch (SchedType & ~OMPScheduleType::MonotonicityMask) { @@ -163,6 +151,18 @@ static bool isValidWorkshareLoopScheduleType(OMPScheduleType SchedType) { } #endif +/// This is wrapper over IRBuilderBase::restoreIP that also restores the current +/// debug location to the last instruction in the specified basic block if the +/// insert point points to the end of the block. +static void restoreIPandDebugLoc(llvm::IRBuilderBase &Builder, + llvm::IRBuilderBase::InsertPoint IP) { + Builder.restoreIP(IP); + llvm::BasicBlock *BB = Builder.GetInsertBlock(); + llvm::BasicBlock::iterator I = Builder.GetInsertPoint(); + if (!BB->empty() && I == BB->end()) + Builder.SetCurrentDebugLocation(BB->back().getStableDebugLoc()); +} + static const omp::GV &getGridValue(const Triple &T, Function *Kernel) { if (T.isAMDGPU()) { StringRef Features =