-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Missed optimization in i.div_euclid(power_of_two) #71096
Labels
A-codegen
Area: Code generation
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
C-optimization
Category: An issue highlighting optimization opportunities or PRs implementing such
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
I-slow
Issue: Problems and improvements with respect to performance of generated code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
jonas-schievink
added
A-codegen
Area: Code generation
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
I-slow
Issue: Problems and improvements with respect to performance of generated code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Apr 13, 2020
nagisa
added
the
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
label
Apr 14, 2020
I market this as A-LLVM as it could also be an opttimisation in LLVM, but I suspect that we may just need to write the function in a way that would make this more obvious to LLVM. |
workingjubilee
added
the
C-optimization
Category: An issue highlighting optimization opportunities or PRs implementing such
label
Oct 8, 2023
rustc 1.70 has already fixed this issue: https://rust.godbolt.org/z/YxdfjMdxh. @rustbot label E-needs-test -llvm-fixed-upstream |
rustbot
added
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
llvm-fixed-upstream
Issue expected to be fixed by the next major LLVM upgrade
and removed
llvm-fixed-upstream
Issue expected to be fixed by the next major LLVM upgrade
labels
Mar 29, 2024
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Jun 9, 2024
Add codegen tests for E-needs-test close rust-lang#36010 close rust-lang#68667 close rust-lang#74938 close rust-lang#83585 close rust-lang#93036 close rust-lang#109328 close rust-lang#110797 close rust-lang#111508 close rust-lang#112509 close rust-lang#113757 close rust-lang#120440 close rust-lang#118392 close rust-lang#71096 r? nikic
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Jun 10, 2024
Add codegen tests for E-needs-test close rust-lang#36010 close rust-lang#68667 close rust-lang#74938 close rust-lang#83585 close rust-lang#93036 close rust-lang#109328 close rust-lang#110797 close rust-lang#111508 close rust-lang#112509 close rust-lang#113757 close rust-lang#120440 close rust-lang#118392 close rust-lang#71096 r? nikic
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Jun 11, 2024
Add codegen tests for E-needs-test close rust-lang#36010 close rust-lang#68667 close rust-lang#74938 close rust-lang#83585 close rust-lang#93036 close rust-lang#109328 close rust-lang#110797 close rust-lang#111508 close rust-lang#112509 close rust-lang#113757 close rust-lang#120440 close rust-lang#118392 close rust-lang#71096 r? nikic
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Jun 13, 2024
Add codegen tests for E-needs-test close rust-lang#36010 close rust-lang#68667 close rust-lang#74938 close rust-lang#83585 close rust-lang#93036 close rust-lang#109328 close rust-lang#110797 close rust-lang#111508 close rust-lang#112509 close rust-lang#113757 close rust-lang#120440 close rust-lang#118392 close rust-lang#71096 r? nikic
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-codegen
Area: Code generation
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
C-optimization
Category: An issue highlighting optimization opportunities or PRs implementing such
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
I-slow
Issue: Problems and improvements with respect to performance of generated code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
If a signed integer is divided by a power of two using Euclidean division, it is equivalent to an arithmetic shift, but this is not caught. For example
produces the assembly code
while it could simply be
The LLVM IR is
which I interpret to be something like
(I did check that this function produces the same LLVM IR.)
I don't know LLVM enough to know whether there is some kind of flooring division intrinsic that could be used to optimize this, or whether this a missed optimization in the LLVM side and LLVM can recognize that pattern into an arithmetic shift.
The text was updated successfully, but these errors were encountered: