-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
RangeInclusive
and Range
bits are not optimizes a way but also not used in a function
#116861
Comments
RangeInclusive
bits are not optimizes a way but also not used in a functionRangeInclusive
and Range
bits are not optimizes a way but also not used in a function
This is, unfortunately, well known. It'll be optimized out in |
Please open issues if you see any more problems like this. I think this general situation is more of a problem than our issue tracker suggests. If you report them we'll be more aware of the trend, and we can paper over individual situations like this one. I think that's what my linked PR does. |
@scottmcm @saethlin maybe to clarify.
But the |
|
Add #[inline] to some recalcitrant ops::range methods Fixes rust-lang#116861
Add #[inline] to some recalcitrant ops::range methods Fixes rust-lang/rust#116861
Add #[inline] to some recalcitrant ops::range methods Fixes rust-lang/rust#116861
Add #[inline] to some recalcitrant ops::range methods Fixes rust-lang/rust#116861
I tried this code: Also godbolt link https://rust.godbolt.org/z/9qs4cTP4v
I expected to see this happen:
I was trying this code to see what kind of assemble the compilers makes.
I tried different optimize levels.
I see with optimize levels
s
and1
, that theRangeInclusive
bits are still there but not used in the function.function is self takes about 5 instructions and the
RangeInclusive
code about 40 instruction, which is dead code.Instead, this happened:
RangeInclusive
bits removed in all the optimize levels.I was using a similar code on a embedded device.
FYI: It also happens with
Range
. Remove the=
before 247.Meta
I see this happen on stable and nightly both for x86_64 and thumbv6/v7.
The text was updated successfully, but these errors were encountered: