From 8f61eb9341f6f4100fe3bb2ed68e769f8a3033cc Mon Sep 17 00:00:00 2001 From: Chris Fallin Date: Wed, 1 Jun 2022 13:26:20 -0700 Subject: [PATCH] Upgrade to regalloc2 version 0.2.1. (#4199) This resolves an edge-case where mul.i128 with an input that continues to be live after the instruction could cause an invalid regalloc constraint (basically, the regalloc did not previously support an instruction use and def both being constrained to the same physical reg; and the "mul" variant used for mul.i128 on x64 was the only instance of such operands in Cranelift). Causes two extra move instructions in the mul.i128 filetest, but that's the price to pay for the slightly more general (works in all cases) handling of the constraints. --- Cargo.lock | 4 ++-- cranelift/codegen/Cargo.toml | 2 +- cranelift/filetests/filetests/isa/x64/i128.clif | 12 +++++++----- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 160b11804b..db66d79c17 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2351,9 +2351,9 @@ dependencies = [ [[package]] name = "regalloc2" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e5ed49768d554b34463e467c27af849a7335c051d3ac402c4755f8366c6e0b" +checksum = "dac38642b54866528dc69ab1d8d041cd13f5546a928b911004ab52611be66b3d" dependencies = [ "fxhash", "log", diff --git a/cranelift/codegen/Cargo.toml b/cranelift/codegen/Cargo.toml index 0185bad514..19a998de99 100644 --- a/cranelift/codegen/Cargo.toml +++ b/cranelift/codegen/Cargo.toml @@ -23,7 +23,7 @@ serde = { version = "1.0.94", features = ["derive"], optional = true } bincode = { version = "1.2.1", optional = true } gimli = { version = "0.26.0", default-features = false, features = ["write"], optional = true } smallvec = { version = "1.6.1" } -regalloc2 = { version = "0.2.0", features = ["checker"] } +regalloc2 = { version = "0.2.1", features = ["checker"] } souper-ir = { version = "2.1.0", optional = true } # It is a goal of the cranelift-codegen crate to have minimal external dependencies. # Please don't add any unless they are essential to the task of creating binary diff --git a/cranelift/filetests/filetests/isa/x64/i128.clif b/cranelift/filetests/filetests/isa/x64/i128.clif index e71170c9d6..e8ebeb5bb8 100644 --- a/cranelift/filetests/filetests/isa/x64/i128.clif +++ b/cranelift/filetests/filetests/isa/x64/i128.clif @@ -115,13 +115,15 @@ block0(v0: i128, v1: i128): ; block0: ; movq %rdi, %r9 ; imulq %r9, %rcx, %r9 -; movq %rdi, %rax ; imulq %rsi, %rdx, %rsi -; addq %r9, %rsi, %r9 +; movq %r9, %r8 +; addq %r8, %rsi, %r8 +; movq %r8, %r9 +; movq %rdi, %rax ; mul %rax, %rdx, %rax, %rdx -; movq %r9, %rdi -; addq %rdi, %rdx, %rdi -; movq %rdi, %r9 +; movq %r9, %r11 +; addq %r11, %rdx, %r11 +; movq %r11, %r9 ; movq %r9, %rdx ; movq %rbp, %rsp ; popq %rbp