feat(llvm): Add optional latch→header connection in LoopForm

- Added NYASH_LOOPFORM_LATCH2HEADER environment variable
- When enabled, latch block jumps back to header (completing the loop)
- When disabled (default), latch remains unreachable (safe mode)
- Preserves header predecessor count stability in default mode

This allows gradual testing of full LoopForm loop structure.
This commit is contained in:
Selfhosting Dev
2025-09-12 16:55:25 +09:00
parent 65497bac04
commit da51f0e51b
2 changed files with 13 additions and 2 deletions

View File

@ -500,6 +500,9 @@ impl LLVMCompiler {
}
}
}
// Note: LoopForm latch→header adds a new LLVM pred not represented in MIR.
// Header PHI normalization for this extra pred will be implemented later
// using a LoopForm-aware finalize that does not rely on MIR inputs.
}
}
// Finalize function: ensure every basic block is closed with a terminator.