Upgrade to regalloc2 0.1.3. (#4157)

* Upgrade to regalloc2 0.1.3.

This pulls in bytecodealliance/regalloc2#49, which slightly improves
codegen in some cases where a safepoint (for reference-typed values)
occurs in the same liverange as a register-constrained use. For
example, in bytecodealliance/wasmtime#3785, an extra move instruction
appeared and a callee-save register was used (necessitating a more
expensive prologue) because of suboptimal splitting heuristics, which
this PR fixes. The updated RA2 heuristics appear to have no measured
downsides in existing benchmarks and improve the manually-observed
codegen issue.

* Update filetests where regalloc2 improvement altered behavior with reftypes.
This commit is contained in:
Chris Fallin
2022-05-18 11:48:40 -07:00
committed by GitHub
parent ca106e9bcd
commit 02d5edc591
4 changed files with 18 additions and 22 deletions

4
Cargo.lock generated
View File

@@ -2351,9 +2351,9 @@ dependencies = [
[[package]] [[package]]
name = "regalloc2" name = "regalloc2"
version = "0.1.2" version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ec1c2e4f4b879982653d243d9561d9f49004ce15a47e9682ad1f6d53a06aac0" checksum = "904196c12c9f55d3aea578613219f493ced8e05b3d0c6a42d11cb4142d8b4879"
dependencies = [ dependencies = [
"fxhash", "fxhash",
"log", "log",

View File

@@ -23,7 +23,7 @@ serde = { version = "1.0.94", features = ["derive"], optional = true }
bincode = { version = "1.2.1", optional = true } bincode = { version = "1.2.1", optional = true }
gimli = { version = "0.26.0", default-features = false, features = ["write"], optional = true } gimli = { version = "0.26.0", default-features = false, features = ["write"], optional = true }
smallvec = { version = "1.6.1" } smallvec = { version = "1.6.1" }
regalloc2 = { version = "0.1.2", features = ["checker"] } regalloc2 = { version = "0.1.3", features = ["checker"] }
souper-ir = { version = "2.1.0", optional = true } souper-ir = { version = "2.1.0", optional = true }
# It is a goal of the cranelift-codegen crate to have minimal external dependencies. # 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 # Please don't add any unless they are essential to the task of creating binary

View File

@@ -67,28 +67,25 @@ block3(v7: r64, v8: r64):
; mov fp, sp ; mov fp, sp
; sub sp, sp, #32 ; sub sp, sp, #32
; block0: ; block0:
; mov x4, x1 ; str x1, [sp, #16]
; mov x2, x0 ; str x0, [sp, #8]
; ldr x3, 8 ; b 12 ; data TestCase { length: 1, ascii: [102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] } + 0 ; ldr x3, 8 ; b 12 ; data TestCase { length: 1, ascii: [102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] } + 0
; str x2, [sp, #8]
; str x4, [sp, #16]
; blr x3 ; blr x3
; ldr x2, [sp, #8]
; mov x9, sp ; mov x9, sp
; mov x12, x2 ; ldr x10, [sp, #8]
; str x12, [x9] ; str x10, [x9]
; and w7, w0, #1 ; and w7, w0, #1
; cbz x7, label1 ; b label3 ; cbz x7, label1 ; b label3
; block1: ; block1:
; b label2 ; b label2
; block2: ; block2:
; mov x1, x12 ; mov x1, x10
; ldr x0, [sp, #16] ; ldr x0, [sp, #16]
; b label5 ; b label5
; block3: ; block3:
; b label4 ; b label4
; block4: ; block4:
; mov x0, x12 ; mov x0, x10
; ldr x1, [sp, #16] ; ldr x1, [sp, #16]
; b label5 ; b label5
; block5: ; block5:

View File

@@ -69,27 +69,26 @@ block3(v7: r64, v8: r64):
; aghi %r15, -184 ; aghi %r15, -184
; virtual_sp_offset_adjust 160 ; virtual_sp_offset_adjust 160
; block0: ; block0:
; lgr %r4, %r3 ; stg %r3, 176(%r15)
; lgr %r3, %r2 ; stg %r2, 168(%r15)
; bras %r1, 12 ; data %f + 0 ; lg %r5, 0(%r1) ; bras %r1, 12 ; data %f + 0 ; lg %r5, 0(%r1)
; stg %r3, 168(%r15)
; stg %r4, 176(%r15)
; basr %r14, %r5 ; basr %r14, %r5
; lg %r3, 168(%r15) ; la %r3, 160(%r15)
; la %r4, 160(%r15) ; lg %r4, 168(%r15)
; stg %r3, 0(%r4) ; stg %r4, 0(%r3)
; llcr %r4, %r2 ; llcr %r5, %r2
; chi %r4, 0 ; chi %r5, 0
; jgnlh label1 ; jg label3 ; jgnlh label1 ; jg label3
; block1: ; block1:
; jg label2 ; jg label2
; block2: ; block2:
; lgr %r3, %r4
; lg %r2, 176(%r15) ; lg %r2, 176(%r15)
; jg label5 ; jg label5
; block3: ; block3:
; jg label4 ; jg label4
; block4: ; block4:
; lgr %r2, %r3 ; lgr %r2, %r4
; lg %r3, 176(%r15) ; lg %r3, 176(%r15)
; jg label5 ; jg label5
; block5: ; block5: