Stream: git-wasmtime

Topic: wasmtime / PR #8510 cranelift: add icmp-of-icmp rules for...


view this post on Zulip Wasmtime GitHub notifications bot (Apr 30 2024 at 18:13):

tertsdiepraam opened PR #8510 from tertsdiepraam:cranelift-icmp-icmp-1 to bytecodealliance:main:

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

Suggested by @cfallin in this zulip thread: https://bytecodealliance.zulipchat.com/#narrow/stream/217117-cranelift/topic/disassemly.20seems.20.28relatively.29.20unoptimized

The icmp-of-icmp rules only included comparisons with 0. So this

(x == y) != 0

gets simplified to

x == y

But the equivalent

(x == y) == 1

did not get simplified, even though the rules to apply are just the inverse of the rules for 0.

I've added the rules for icmp(..) == 1 and icmp(..) != 1 and tried to add some more comments to the existing rules.

I need some help to figure out how I could write a test for this, because I haven't found the tests in the codebase :)

view this post on Zulip Wasmtime GitHub notifications bot (Apr 30 2024 at 18:13):

tertsdiepraam requested cfallin for a review on PR #8510.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 30 2024 at 18:13):

tertsdiepraam requested wasmtime-compiler-reviewers for a review on PR #8510.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 30 2024 at 18:14):

tertsdiepraam updated PR #8510.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 30 2024 at 18:14):

tertsdiepraam updated PR #8510.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 30 2024 at 18:24):

KGrewal1 submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 30 2024 at 18:24):

KGrewal1 created PR review comment:

are these comments the wrong way around (ie should this be

eq(icmp(ty, cc, x, y), 1) == icmp(ty, cc, x, y)

and similar for the documentation of the other command
?

view this post on Zulip Wasmtime GitHub notifications bot (Apr 30 2024 at 18:33):

tertsdiepraam submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 30 2024 at 18:33):

tertsdiepraam created PR review comment:

Indeed, thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 30 2024 at 18:37):

cfallin commented on PR #8510:

@tertsdiepraam thanks for this! The tests are in cranelift/filetests/filetests/; you can find midend-optimizer-specific tests that assert on expected simplified IR in egraph/, and tests that check execution results in runtests/. Probably both would be good for this case?

view this post on Zulip Wasmtime GitHub notifications bot (Apr 30 2024 at 19:02):

tertsdiepraam updated PR #8510.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 30 2024 at 19:06):

tertsdiepraam commented on PR #8510:

I've added tests both in egraph/ and runtests/ and fixed up the comment. I hope it's good now.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 30 2024 at 19:10):

cfallin submitted PR review:

LGTM -- thanks very much for this contribution!

view this post on Zulip Wasmtime GitHub notifications bot (Apr 30 2024 at 19:11):

cfallin has enabled auto merge for PR #8510.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 30 2024 at 19:53):

cfallin merged PR #8510.


Last updated: Nov 22 2024 at 16:03 UTC