Kmeakin opened PR #6135 from Kmeakin:gvn-commutative
to bytecodealliance:main
:
Normalize instructions with commutative opcodes by sorting the arguments. This means instructions like
iadd v0, v1
andiadd v1, v0
will be considered identical by GVN and de-duplicated.This is not quite ready to merge: I need someone with more knowledge of the IR to confirm that
fcmp
andfmin
/fmax
are commutative in all cases
Kmeakin requested wasmtime-compiler-reviewers for a review on PR #6135.
Kmeakin requested elliottt for a review on PR #6135.
jameysharp requested jameysharp for a review on PR #6135.
jameysharp submitted PR review.
jameysharp submitted PR review.
jameysharp created PR review comment:
Subtraction isn't usually commutative, but I haven't looked at the saturating versions carefully. Is there some reason to include them here?
Kmeakin submitted PR review.
Kmeakin created PR review comment:
Good catch, I copy and pasted all the saturing instructions without checking them individually. Should be only saturating addition
Kmeakin updated PR #6135.
cfallin submitted PR review.
Kmeakin updated PR #6135.
Kmeakin updated PR #6135.
Kmeakin updated PR #6135.
Kmeakin edited PR #6135:
Normalize instructions with commutative opcodes by sorting the arguments. This means instructions like
iadd v0, v1
andiadd v1, v0
will be considered identical by GVN and de-duplicated.
This is not quite ready to merge: I need someone with more knowledge of the IR to confirm thatfcmp
andfmin
/fmax
are commutative in all cases
Kmeakin requested jameysharp for a review on PR #6135.
Kmeakin requested cfallin for a review on PR #6135.
jameysharp submitted PR review.
jameysharp submitted PR review.
jameysharp created PR review comment:
We don't bother checking values which were in the input for these tests, so let's remove this
check: v3
line.
jameysharp created PR review comment:
Looks like we only need the in-place version of
normalize
, if you change this use this way:fn new(mut inst: InstructionData, ty: Type, pos: &'a RefCell<FuncCursor<'f>>) -> Self { inst.normalize_in_place();
So let's delete
InstructionData::normalize
. I'd especially prefer that given that we're going to deletesimple_gvn
anyway.
jameysharp created PR review comment:
We don't bother checking values which were in the input for these tests, so let's remove this
check: v3
line.
Kmeakin updated PR #6135.
Kmeakin updated PR #6135.
Kmeakin requested jameysharp for a review on PR #6135.
jameysharp merged PR #6135.
Last updated: Nov 22 2024 at 17:03 UTC