Merge pull request #5094 from pmatos/fix/issue5084

Set current code block in x87 pass
This commit is contained in:
Ryan Houdek authored and GitHub committed 2025-12-02 14:43:54 -08:00
commit 90c8fcf393
2 files changed
+32

No files matched your search

@@ -733,6 +733,7 @@ void X87StackOptimization::Run(IREmitter* Emit) {
// The optimization should run per-block
Reset();
IREmit->SetCurrentCodeBlock(BlockNode);
for (auto [CodeNode, IROp] : CurrentIR.GetCode(BlockNode)) {
if (!LoweredX87(IROp->Op)) {
continue;
@@ -0,0 +1,31 @@
%ifdef CONFIG
{
"RegData": {
"RAX": "0x0"
}
}
%endif
; Regression test for issue 5084
; This test was mostly reverse engineered from the IR in 5084.
; Failed with '-n 500 -m' with the error message:
; %51: Arg[0] references invalid %24
mov rax, 0
mov rbx, 0xe0000000
mov rcx, 1
test rcx, rcx
jnz .late_target
.fallthrough:
fld1
fstp tword [rbx + 0x1234]
mov rax, 0
hlt
.late_target:
fld1
fstp tword [rbx + 0x1234]
mov rax, 0
hlt