Conversation
When t2c_trace_ebb() compiles a block whose last instruction is a non-branching, non-terminal instruction (e.g., addi, lw, sw) with no branch_taken/branch_untaken pointers, no LLVM terminator was emitted. This produced malformed IR that crashed LLVMRunPasses during the LowerExpectIntrinsicPass. This occurs when a block ends at a page boundary or instruction limit before block chaining is established, or when a linked block has been evicted from the cache. This adds a safety check at the end of t2c_trace_ebb() using LLVMGetBasicBlockTerminator() to detect unterminated blocks. When found, store block->pc_end to rv->PC, flush the cycle counter, and emit ret void to return control to the interpreter. Close #718
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When t2c_trace_ebb() compiles a block whose last instruction is a non-branching, non-terminal instruction (e.g., addi, lw, sw) with no branch_taken/branch_untaken pointers, no LLVM terminator was emitted. This produced malformed IR that crashed LLVMRunPasses during the LowerExpectIntrinsicPass.
This occurs when a block ends at a page boundary or instruction limit before block chaining is established, or when a linked block has been evicted from the cache.
This adds a safety check at the end of t2c_trace_ebb() using LLVMGetBasicBlockTerminator() to detect unterminated blocks. When found, store block->pc_end to rv->PC, flush the cycle counter, and emit ret void to return control to the interpreter.
Close #718
Summary by cubic
Fixes a crash during LLVMRunPasses (LowerExpectIntrinsicPass) by ensuring every compiled basic block is properly terminated. If a block ends without a branch or a resolvable target, we now return to the interpreter safely.
Written for commit 9b56311. Summary will update on new commits.