Skip to content

Commit

Permalink
LLVM 20: Update for getFirstNonPHIOrDbg.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hvdijk committed Jan 29, 2025
1 parent 87f32a7 commit 6c65268
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/compiler/compiler_pipeline/source/barrier_regions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ Function *compiler::utils::Barrier::GenerateNewKernel(BarrierRegion &region) {
}

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;

Expand Down Expand Up @@ -1290,7 +1290,7 @@ Function *compiler::utils::Barrier::GenerateNewKernel(BarrierRegion &region) {
}

// 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();
Expand Down

0 comments on commit 6c65268

Please sign in to comment.