Stream: git-wasmtime

Topic: wasmtime / PR #4068 x64 backend: fix a load-op merging bu...


view this post on Zulip Wasmtime GitHub notifications bot (Apr 25 2022 at 16:46):

cfallin opened PR #4068 from fix-cmp-and-choose-load-op-merging to main:

The recent work in #4061 introduced a notion of "unique uses" for CLIF
values that both simplified the load-op merging rules and allowed
loads to merge in some more places.

Unfortunately there's one factor that PR didn't account for: a unique
use at the CLIF level could become a multiple-use at the VCode level,
when a lowering uses a value multiple times!

Making this less error-prone in general is hard, because we don't know
the lowering in VCode until it's emitted, so we can't ahead-of-time
know that a value will be used multiple times and prevent its
merging. But we can know in the lowerings themselves when we're
doing this. At least we get a panic from regalloc when we get this
wrong; no bad code (uninitialized register being read) should ever
come from a backend bug like this.

This is still a bit less than ideal, but for now the fix is: in
cmp_and_choose in the x64 backend (which compares values, then
picks one or the other with a cmove), explicitly put values in
registers.

Fixes #4067 (thanks @Mrmaxmeier for the report!).

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (Apr 25 2022 at 16:46):

cfallin requested fitzgen for a review on PR #4068.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 25 2022 at 16:46):

cfallin requested abrown for a review on PR #4068.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 25 2022 at 17:22):

abrown submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 25 2022 at 17:22):

abrown submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 25 2022 at 17:22):

fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 25 2022 at 17:32):

cfallin merged PR #4068.


Last updated: Oct 23 2024 at 20:03 UTC