Skip to content

Commit

Permalink
Remove invalid branch
Browse files Browse the repository at this point in the history
  • Loading branch information
vosen committed May 16, 2024
1 parent 52a392c commit 9cd38ac
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ptx/src/emit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3610,16 +3610,15 @@ fn terminate_current_block_if_not_terminated(

// Some PTX instructions (exit) that are LLVM terminators
// can be emitted in the middle of a basic block
// Happens in eg. Meshroom
// Happens in e.g. Meshroom
fn start_next_block_if_terminated(ctx: &mut EmitContext) {
let current_block = unsafe { LLVMGetInsertBlock(ctx.builder.get()) };
let terminator = unsafe { LLVMGetBasicBlockTerminator(current_block) };
if terminator == ptr::null_mut() {
return;
}
let next_block = unsafe { LLVMCreateBasicBlockInContext(ctx.context.get(), LLVM_UNNAMED) };
unsafe { LLVMBuildBr(ctx.builder.get(), next_block) };
unsafe { LLVMMoveBasicBlockAfter(next_block, current_block) };
unsafe { LLVMInsertExistingBasicBlockAfterInsertBlock(ctx.builder.get(), next_block) };
unsafe { LLVMPositionBuilderAtEnd(ctx.builder.get(), next_block) };
}

Expand Down

0 comments on commit 9cd38ac

Please sign in to comment.