rust/compiler
bors 2e0edc0f28 Auto merge of #75119 - simonvandel:early-otherwise, r=oli-obk
New MIR optimization pass to reduce branches on match of tuples of enums

Fixes #68867 by adding a new pass that turns something like
```rust
let x: Option<()>;
let y: Option<()>;
match (x,y) {
    (Some(_), Some(_)) => {0},
    _ => {1}
}
```
into something like
```rust
let x: Option<()>;
let y: Option<()>;
let discriminant_x = // get discriminant of x
let discriminant_y = // get discriminant of x
if discriminant_x != discriminant_y {1} else {0}
```

The opt-diffs still have the old basic blocks like
```
bb3: {
          _8 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early-otherwise-branch-68867.rs:21:21: 21:30
          switchInt(move _8) -> [1_isize: bb7, otherwise: bb2]; // scope 0 at $DIR/early-otherwise-branch-68867.rs:21:21: 21:30
      }

      bb4: {
          _9 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early-otherwise-branch-68867.rs:22:23: 22:34
          switchInt(move _9) -> [2_isize: bb8, otherwise: bb2]; // scope 0 at $DIR/early-otherwise-branch-68867.rs:22:23: 22:34
      }

      bb5: {
          _10 = discriminant((*(_4.1: &ViewportPercentageLength))); // scope 0 at $DIR/early-otherwise-branch-68867.rs:23:23: 23:34
          switchInt(move _10) -> [3_isize: bb9, otherwise: bb2]; // scope 0 at $DIR/early-otherwise-branch-68867.rs:23:23: 23:34
      }
```

These do get removed on later passes. I'm not sure if I should include those passes in the test to make it clear?
2020-09-20 17:54:44 +00:00
..
rustc just max_level_info 2020-09-11 09:37:51 -07:00
rustc_apfloat mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_arena Rollup merge of #76821 - est31:remove_redundant_nightly_features, r=oli-obk,Mark-Simulacrum 2020-09-20 12:08:22 +02:00
rustc_ast Rollup merge of #76890 - matthiaskrgr:matches_simpl, r=lcnr 2020-09-20 15:52:01 +02:00
rustc_ast_lowering simplfy condition in ItemLowerer::with_trait_impl_ref() 2020-09-16 23:09:57 +02:00
rustc_ast_passes use matches!() macro for simple if let conditions 2020-09-18 20:28:35 +02:00
rustc_ast_pretty Fully integrate token collection for additional AST structs 2020-09-10 17:58:14 -04:00
rustc_attr use matches!() macro for simple if let conditions 2020-09-18 20:28:35 +02:00
rustc_builtin_macros use matches!() macro for simple if let conditions 2020-09-18 20:28:35 +02:00
rustc_codegen_llvm Auto merge of #76964 - RalfJung:rollup-ybn06fs, r=RalfJung 2020-09-20 11:02:36 +00:00
rustc_codegen_ssa Rollup merge of #76832 - khyperia:backend_target_override, r=eddyb 2020-09-20 15:51:48 +02:00
rustc_data_structures Rollup merge of #76825 - lcnr:array-windows-apply, r=varkor 2020-09-20 12:08:26 +02:00
rustc_driver use strip_prefix over starts_with and manual slicing based on pattern length (clippy::manual_strip) 2020-09-17 10:13:16 +02:00
rustc_error_codes Adjust spelling 2020-09-15 18:10:41 +02:00
rustc_errors use matches!() macro for simple if let conditions 2020-09-18 20:28:35 +02:00
rustc_expand Remove redundant #![feature(...)] 's from compiler/ 2020-09-17 07:58:45 +02:00
rustc_feature Stabilize doc_alias feature 2020-09-14 11:03:47 +02:00
rustc_fs_util mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_graphviz Make graphviz font configurable 2020-09-16 08:10:06 -07:00
rustc_hir review, improve note span 2020-09-13 22:53:51 +02: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 Improve BitSet APIs 2020-08-30 11:13:18 -07:00
rustc_infer Auto merge of #76964 - RalfJung:rollup-ybn06fs, r=RalfJung 2020-09-20 11:02:36 +00:00
rustc_interface PR feedback 2020-09-17 12:18:09 +02:00
rustc_lexer lexer: Tiny improvement to shebang detection 2020-09-02 00:40:19 +03:00
rustc_lint Rollup merge of #76910 - lcnr:foreign-item-like, r=oli-obk 2020-09-20 15:52:04 +02:00
rustc_llvm Update cc crate to understand aarch64-apple-darwin with clang 2020-09-18 09:22:07 -04:00
rustc_macros Fix non-determinism in generated format string. 2020-09-09 21:23:25 +10:00
rustc_metadata support const_evaluatable_checked across crate boundaries 2020-09-18 17:11:34 +02:00
rustc_middle Rollup merge of #76891 - lcnr:less-ref, r=ecstatic-morse 2020-09-20 15:52:03 +02:00
rustc_mir Auto merge of #75119 - simonvandel:early-otherwise, r=oli-obk 2020-09-20 17:54:44 +00:00
rustc_mir_build Rollup merge of #76890 - matthiaskrgr:matches_simpl, r=lcnr 2020-09-20 15:52:01 +02:00
rustc_parse Remove redundant #![feature(...)] 's from compiler/ 2020-09-17 07:58:45 +02:00
rustc_parse_format Remove redundant #![feature(...)] 's from compiler/ 2020-09-17 07:58:45 +02:00
rustc_passes transmute: use diagnostic item 2020-09-19 11:33:11 +02:00
rustc_plugin_impl mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_privacy Rollup merge of #76821 - est31:remove_redundant_nightly_features, r=oli-obk,Mark-Simulacrum 2020-09-20 12:08:22 +02:00
rustc_query_system update the version of itertools and parking_lot 2020-09-12 08:26:53 +02:00
rustc_resolve Rollup merge of #76890 - matthiaskrgr:matches_simpl, r=lcnr 2020-09-20 15:52:01 +02:00
rustc_save_analysis use push(char) instead of push_str(&str) to add single chars to strings 2020-09-10 13:58:41 +02:00
rustc_serialize mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
rustc_session Rollup merge of #76832 - khyperia:backend_target_override, r=eddyb 2020-09-20 15:51:48 +02:00
rustc_span Rollup merge of #76825 - lcnr:array-windows-apply, r=varkor 2020-09-20 12:08:26 +02:00
rustc_symbol_mangling Change ty.kind to a method 2020-09-04 17:47:51 +02:00
rustc_target librustc_target: Address comments 2020-09-14 17:43:06 -07:00
rustc_trait_selection Auto merge of #76886 - Aaron1011:fix/ensure-stack-predicate, r=Mark-Simulacrum 2020-09-19 09:21:22 +00:00
rustc_traits Remove redundant #![feature(...)] 's from compiler/ 2020-09-17 07:58:45 +02:00
rustc_ty Remove redundant #![feature(...)] 's from compiler/ 2020-09-17 07:58:45 +02:00
rustc_typeck Rollup merge of #76940 - Aaron1011:fix/trait-on-tait, r=oli-obk 2020-09-20 15:52:09 +02:00