From 9cd38ac5328d5f6bbe5f09ee9f5aca90ab0b2920 Mon Sep 17 00:00:00 2001 From: Andrzej Janik Date: Thu, 16 May 2024 23:26:07 +0200 Subject: [PATCH] Remove invalid branch --- ptx/src/emit.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ptx/src/emit.rs b/ptx/src/emit.rs index f3e5cafe..1c88cd0e 100644 --- a/ptx/src/emit.rs +++ b/ptx/src/emit.rs @@ -3610,7 +3610,7 @@ 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) }; @@ -3618,8 +3618,7 @@ fn start_next_block_if_terminated(ctx: &mut EmitContext) { 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) }; }