Skip to content

Issue 54 #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,13 @@ private CopyItem isCycle(List<CopyItem> copySet, Register src) {
private void addMoveAtBBEnd(BasicBlock block, Register src, Register dest) {
var inst = new Instruction.Move(new Operand.RegisterOperand(src), new Operand.RegisterOperand(dest));
insertAtEnd(block, inst);
// If the copy instruction is followed by a cbr which uses the old var
// then we need to update the cbr instruction
// This is not specified in the Briggs paper but t
var brInst = block.instructions.getLast();
if (brInst instanceof Instruction.ConditionalBranch cbr) {
cbr.replaceUse(src,dest);
}
}
/* Insert a copy from constant src to dst at end of BB */
private void addMoveAtBBEnd(BasicBlock block, Operand.ConstantOperand src, Register dest) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3156,7 +3156,7 @@ func bug(N: Int)
if %t2_0 goto L3 else goto L4
L3:
p_5 = p_1
if p_1 goto L5 else goto L6
if p_5 goto L5 else goto L6
L5:
%t3_0 = p_1+1
p_4 = %t3_0
Expand Down