Skip to content

Commit b8d93ea

Browse files
authored
wasm2js: remove some unneeded code, which also has some risks of incorrectness (#2032)
The risk is that the children's type may be unreachable, in which case we may have forgotten the signing, and could get incorrect results.
1 parent b99d668 commit b8d93ea

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

src/wasm2js.h

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,21 +1648,12 @@ Ref Wasm2JSBuilder::processFunctionBody(Module* m, Function* func, IString resul
16481648
ret = ValueBuilder::makeBinary(left, RSHIFT, right);
16491649
break;
16501650
case EqInt32: {
1651-
// TODO: check if this condition is still valid/necessary
1652-
if (curr->left->type == i32) {
1653-
return ValueBuilder::makeBinary(makeSigning(left, ASM_SIGNED), EQ,
1654-
makeSigning(right, ASM_SIGNED));
1655-
} else {
1656-
return ValueBuilder::makeBinary(left, EQ, right);
1657-
}
1651+
return ValueBuilder::makeBinary(makeSigning(left, ASM_SIGNED), EQ,
1652+
makeSigning(right, ASM_SIGNED));
16581653
}
16591654
case NeInt32: {
1660-
if (curr->left->type == i32) {
1661-
return ValueBuilder::makeBinary(makeSigning(left, ASM_SIGNED), NE,
1662-
makeSigning(right, ASM_SIGNED));
1663-
} else {
1664-
return ValueBuilder::makeBinary(left, NE, right);
1665-
}
1655+
return ValueBuilder::makeBinary(makeSigning(left, ASM_SIGNED), NE,
1656+
makeSigning(right, ASM_SIGNED));
16661657
}
16671658
case LtSInt32:
16681659
return ValueBuilder::makeBinary(makeSigning(left, ASM_SIGNED), LT,

0 commit comments

Comments
 (0)