rust/compiler/rustc_middle/src/mir
Michael Goulet 5460f92a0f
Rollup merge of #112168 - scottmcm:lower-div-rem-unchecked-to-mir, r=oli-obk
Lower `unchecked_div`/`_rem` to MIR's `BinOp::Div`/`Rem`

As described in <https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/enum.BinOp.html#variant.Div>, the ordinary `BinOp`s for these are already UB for division by zero ([or overflow](https://llvm.org/docs/LangRef.html#sdiv-instruction), [demo](https://rust.godbolt.org/z/71e7P7Exh)), as MIR building is responsible for inserting code to panic for those cases regardless of whether the overflow checks are enabled.

So we can lower these in the same arm that lowers `wrapping_add` to MIR `BinOp::Add` and such, as all these cases turn into ordinary `Rvalue::BinaryOp`s.
2023-06-02 16:02:06 -07:00
..
interpret improve debug message by eagerly translating 2023-06-01 14:45:19 +00:00
basic_blocks.rs Merge DominatorTree and Dominators. 2023-05-17 10:37:29 +00:00
coverage.rs Replace enum ==s with matches where it makes sense 2023-01-30 12:26:26 +00:00
generic_graph.rs Replace Body::basic_blocks() with field access 2022-08-26 14:27:08 +02:00
generic_graphviz.rs Remove redundant graphviz escaping 2022-11-14 15:11:18 +01:00
graphviz.rs Remove WithOptconstParam. 2023-04-20 17:48:32 +00:00
mod.rs Use translatable diagnostics in rustc_const_eval 2023-06-01 14:45:18 +00:00
mono.rs Improve CGU debug printing. 2023-06-01 11:31:22 +10:00
patch.rs Split {Idx, IndexVec, IndexSlice} into their own modules 2023-04-24 13:53:35 +00:00
pretty.rs Use translatable diagnostics in rustc_const_eval 2023-06-01 14:45:18 +00:00
query.rs Rename tcx.mk_re_* => Region::new_* 2023-05-29 17:54:53 +00:00
spanview.rs Rename Abort terminator to Terminate 2023-04-06 09:34:16 +01:00
syntax.rs Rollup merge of #112168 - scottmcm:lower-div-rem-unchecked-to-mir, r=oli-obk 2023-06-02 16:02:06 -07:00
tcx.rs offset_of 2023-04-21 02:14:02 -07:00
terminator.rs Tweak the post-order for multi-successor blocks 2023-05-21 17:48:36 -07:00
traversal.rs Tweak the post-order for multi-successor blocks 2023-05-21 17:48:36 -07:00
type_foldable.rs intern offsetof fields 2023-04-21 02:14:03 -07:00
visit.rs unique borrows are mutating uses 2023-05-29 17:15:48 +02:00