-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Unnecessary instructions generated #75978
Comments
Two observations:
|
This would very likely be fixed by https://reviews.llvm.org/D87972. |
Fixed by #81451 |
There should be codegen test for this issue. |
Yeah, right. I can add those for the issues I closed. |
Actually, I'm reopening this one as the issue stands on ARM: https://rust.godbolt.org/z/6fEdoq |
Looks like a phase ordering problem. The remaining IR would be eliminated by GVN + InstCombine. Currently it only gets eliminated by DAGCombine, thus you still see the prologue/epilogue on ARM. |
The problem here is that this loop only gets unrolled during full loop unrolling, while we need it to be unrolled during simple unrolling to still have a chance to optimize. For the IR at that point, SCEV cannot determine the loop trip count:
|
Fixed by the LLVM 16 upgrade. |
Add codegen tests for issues fixed by LLVM 16 Fixes rust-lang#75978. Fixes rust-lang#99960. Fixes rust-lang#101048. Fixes rust-lang#101082. Fixes rust-lang#101814. Fixes rust-lang#103132. Fixes rust-lang#103327.
Add codegen tests for issues fixed by LLVM 16 Fixes rust-lang#75978. Fixes rust-lang#99960. Fixes rust-lang#101048. Fixes rust-lang#101082. Fixes rust-lang#101814. Fixes rust-lang#103132. Fixes rust-lang#103327.
I'm trying to figure out why certain iterator-based algorithms get const-optimized, while others don't and I stumbled upon this case.
example (updated 2021.03.05)
Compiling
fn1
results in the expected machine code, butfn2
has extra stack reserve/free instructions that are not necessary, since the function's contents are optimized away completely. The stack size equals the size of the array.The text was updated successfully, but these errors were encountered: