Boolean optimization no longer works #62993
Labels
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
C-bug
Category: This is a bug.
I-slow
Issue: Problems and improvements with respect to performance of generated code.
regression-from-stable-to-stable
Performance or correctness regression from one stable version to another.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I'm unsure if this is a bug or not. The following code used to perform just as well as if there were no
let
statements. However, sometime since last year, that has changed.Starting with rust 1.33, all the modulos are always computed. While in 1.32, it would stop processing if the year was not divisible by 4. Using compiler explorer, I was able to find when
is_leap_year
assembly output changed. (link to godbolt with assembly output).I wanted to make sure it wasn't a change in LLVM, so I looked at the llvm-ir. The same logic between the llvm-ir and assembly existed. (link to godbolt with llvm-ir output)
Next was to determine exactly when this change occurred,
nightly-2018-12-24
had the optimization andnightly-2018-12-26
did not. Unfortunately,nightly-2018-12-25
won't install viarustup
. I was however able to manually download rustc and std, and was able to verify that it is broken then.So some commit between these two nightly removed this optimization:
rustc 1.33.0-nightly (ddab10a69 2018-12-23)
rustc 1.33.0-nightly (f960f377f 2018-12-24)
The text was updated successfully, but these errors were encountered: