mirror of
https://github.com/FuelLabs/sway.git
synced 2025-12-23 10:11:56 +00:00
Fix LLVM IR building for unreachable empty blocks.
This commit is contained in:
parent
c98398a6c4
commit
7b79969574
1 changed files with 5 additions and 0 deletions
|
|
@ -405,6 +405,11 @@ impl<'ctx, 'ir, 'eng> ModuleLowerer<'ctx, 'ir, 'eng> {
|
|||
for inst_value in block.instruction_iter(self.ir) {
|
||||
self.lower_instruction(inst_value)?;
|
||||
}
|
||||
// If lowering produced no terminator (e.g., unreachable empty blocks),
|
||||
// make the IR structurally valid by injecting an explicit unreachable.
|
||||
if bb.get_terminator().is_none() {
|
||||
let _ = self.builder.build_unreachable();
|
||||
}
|
||||
}
|
||||
|
||||
self.current_block = None;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue