-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Constant folding in typeinf produce worse code #15898
Comments
maybe we should run llvm's dead branch elimination pass before gc-root allocation? we don't want to run passes that might rearrange the instructions and make the job of the allocator harder, but that seems safe enough to me, and would help catch these cases fast. |
Can this somehow be handled in type inference? The typed AST also becomes more scary due to the |
the correct answer is Bottom for dead code, this definitely looks like something type inference should do |
In |
When type inference detects a branch condition is constant, the not taken branch will not be inferred and therefore all the types are left to be
Any
. Unfortunately, codegen is not using this info and therefore emit code for uninferred AST which addes unused GC frame to the function and cause the emitted code to be worse.Example, when const prop doesn't work
When const prop works,
The text was updated successfully, but these errors were encountered: