From 6c652683c894e0da5d96a48f7ddbdbe84c81654d Mon Sep 17 00:00:00 2001 From: Harald van Dijk Date: Wed, 29 Jan 2025 10:29:32 +0000 Subject: [PATCH] LLVM 20: Update for getFirstNonPHIOrDbg. LLVM 20 updates getFirstNonPHIOrDbg() to return an iterator rather than an Instruction *. We can use &* to reliably get an Instruction * across LLVM versions. The variable name insert_point suggests that we should instead change the type of the variable to be an iterator, but despite the name, it is not used merely as an insert point. This should be revisited in the future but may result in changes in behavior that should probably be kept separate from any compatibility fixes. --- modules/compiler/compiler_pipeline/source/barrier_regions.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/compiler/compiler_pipeline/source/barrier_regions.cpp b/modules/compiler/compiler_pipeline/source/barrier_regions.cpp index 07c8b9708..11847eded 100644 --- a/modules/compiler/compiler_pipeline/source/barrier_regions.cpp +++ b/modules/compiler/compiler_pipeline/source/barrier_regions.cpp @@ -1185,7 +1185,7 @@ Function *compiler::utils::Barrier::GenerateNewKernel(BarrierRegion ®ion) { } BasicBlock *new_kernel_entry_block = &(new_kernel->getEntryBlock()); - Instruction *insert_point = new_kernel_entry_block->getFirstNonPHIOrDbg(); + Instruction *insert_point = &*new_kernel_entry_block->getFirstNonPHIOrDbg(); auto *const cloned_barrier_call = region.barrier_inst ? insert_point : nullptr; @@ -1290,7 +1290,7 @@ Function *compiler::utils::Barrier::GenerateNewKernel(BarrierRegion ®ion) { } // Iterate instruction from insert point at entry basic block. - insert_point = new_kernel_entry_block->getFirstNonPHIOrDbg(); + insert_point = &*new_kernel_entry_block->getFirstNonPHIOrDbg(); const RemapFlags remapFlags = RF_IgnoreMissingLocals | llvm::RF_ReuseAndMutateDistinctMDs; BasicBlock::iterator b_iter = insert_point->getIterator();