-
-
Notifications
You must be signed in to change notification settings - Fork 672
Cast to bool by comparing to zero #343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
// TODO: this is inefficient because it has to read a string | ||
let global = assert(this.currentFunction.program.elementsLookup.get(assert(getGetGlobalName(expr)))); | ||
assert(global.kind == ElementKind.GLOBAL); | ||
return canConversionOverflow(assert((<Global>global).type), type); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to the casting itself, more an unrelated fix for reading from an i32 global before converting to an integer smaller than the global's type. Surfaced in the bool test.
btw, why binaryen use |
eqz checks for "== 0" while we need "!= 0". When optimizing, Binaryen converts to eqz if the surrounding code allows it, i.e. double negate. |
I mean cases when we have |
This seems to be from untouched output, which is expected (especially in combination with |
I see. It seems binaryen even better optimize |
See: #342