rust/compiler
bors 397db054cb Auto merge of #75529 - bugadani:bounds-check, r=nagisa
Eliminate some other bound checks when index comes from an enum

#36962 introduced an assumption for the upper limit of the enum's value. This PR adds an assumption to the lower value as well.

I've modified the original codegen test to show that derived (in that case, adding 1) values also don't generate bounds checks.

However, this test is actually carefully crafted to not hit a bug: if the enum's variants are modified to 1 and 2 instead of 2 and 3, the test fails by adding a bounds check. I suppose this is an LLVM issue and #75525, while not exactly in this context should be tracking it.

I'm not at all confident if this patch can be accepted, or even if it _should_ be accepted in this state. But I'm curious about what others think :)

~Improves~ Should improve #13926 but does not close it because it's not exactly predictable, where bounds checks may pop up against the assumptions.
2020-09-01 13:36:52 +00:00
..
rustc cleanup: Remove duplicate library names from Cargo.tomls 2020-08-30 22:57:54 +03:00
rustc_apfloat mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_arena mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_ast mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_ast_lowering mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_ast_passes mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_ast_pretty mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_attr mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_builtin_macros Use string literal directly when available in format 2020-08-30 22:09:58 +02:00
rustc_codegen_llvm Auto merge of #76071 - khyperia:configurable_to_immediate, r=eddyb 2020-09-01 07:44:34 +00:00
rustc_codegen_ssa Auto merge of #75529 - bugadani:bounds-check, r=nagisa 2020-09-01 13:36:52 +00:00
rustc_data_structures datastructures: replace once_cell crate with an impl from std 2020-08-30 20:06:14 +01:00
rustc_driver datastructures: replace once_cell crate with an impl from std 2020-08-30 20:06:14 +01:00
rustc_error_codes Rollup merge of #76103 - GuillaumeGomez:cleanup-e0769, r=Dylan-DPC 2020-08-31 19:18:19 -07:00
rustc_errors mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_expand Rollup merge of #76050 - matklad:pos, r=petrochenkov 2020-08-31 15:22:40 +02:00
rustc_feature mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_fs_util mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_graphviz mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_hir mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_hir_pretty mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_incremental mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_index mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_infer mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_interface Rollup merge of #76075 - marmeladema:remove-once-cell-crate, r=matklad 2020-08-31 15:22:42 +02:00
rustc_lexer Update expect-test to 1.0 2020-08-31 21:04:09 +02:00
rustc_lint mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_macros mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_metadata mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_middle Rollup merge of #76161 - pickfire:patch-3, r=pickfire 2020-08-31 19:18:24 -07:00
rustc_mir Rollup merge of #76002 - richkadel:llvm-coverage-map-gen-6b.3, r=tmandry 2020-08-31 19:18:14 -07:00
rustc_mir_build mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_parse Make StringReader private 2020-08-31 18:01:01 +02:00
rustc_parse_format mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_passes mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_plugin_impl mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_privacy mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_query_system mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_resolve Suggest if let x = y when encountering if x = y 2020-08-30 15:01:06 -07:00
rustc_save_analysis mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_serialize mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_session Rollup merge of #76002 - richkadel:llvm-coverage-map-gen-6b.3, r=tmandry 2020-08-31 19:18:14 -07:00
rustc_span Adds two source span utility functions used in source-based coverage 2020-08-31 18:41:57 -07:00
rustc_symbol_mangling mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_target mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_trait_selection mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_traits mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_ty mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_typeck Suggest if let x = y when encountering if x = y 2020-08-30 15:01:06 -07:00