Uh oh!
There was an error while loading. Please reload this page.
Emit the enum range assumption if the range only contains one element - #83020
Conversation
rust-highfive
commented
Mar 11, 2021
r? @lcnr (rust-highfive has picked a reviewer for you, use r? to override) |
the8472
commented
Mar 11, 2021
Naive question, but couldn't it be turned into a constant instead if there can only be a single value? |
nikic
commented
Mar 11, 2021
This needs a codegen test to make sure the desired optimization takes place. The |
0xPoe
commented
Mar 12, 2021
Now it's look like: .section __TEXT,__text,regular,pure_instructions .macosx_version_min 10,7 .globl _index .p2align 4,0x90_index: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset %rbp,-16movq %rsp, %rbp .cfi_def_cfa_register %rbp movl (%rdi), %eax popq %rbp retq .cfi_endproc.subsections_via_symbols |
This comment has been minimized.
This comment has been minimized.
test: add test case make tidy happy
0xPoe
commented
Mar 12, 2021
I think it's ready for review. |
this does seem fine to me, would it be possible to instead emit a constant if edit: ah, that was already asked in #83020 (comment) |
nikic
commented
Mar 12, 2021
That would be possible, but maybe not worth the bother to special case it? LLVM will end up replacing the value with a constant based on the assumption, so I don't think it will make much of a difference. |
lcnr
commented
Mar 12, 2021
in this case @bors r+ |
bors
commented
Mar 12, 2021
📌 Commit d180f91 has been approved by |
Emit the enum range assumption if the range only contains one element closerust-lang#82871
Rollup of 6 pull requests Successful merges: - rust-lang#82984 (Simplify ast block lowering) - rust-lang#83012 (Update Clippy) - rust-lang#83020 (Emit the enum range assumption if the range only contains one element) - rust-lang#83037 (Support merge_functions option in NewPM since LLVM >= 12) - rust-lang#83052 (updated vulnerable deps) - rust-lang#83059 (Allow configuring `rustdoc --disable-minification` in config.toml) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
close#82871