rust/compiler/rustc_codegen_ssa/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
..
analyze.rs unique borrows are mutating uses 2023-05-29 17:15:48 +02:00
block.rs Add a distinct OperandValue::ZeroSized variant for ZSTs 2023-05-31 19:10:28 -07:00
constant.rs ADD - create and emit Bug support for Diagnostics 2022-12-27 20:59:22 -05:00
coverageinfo.rs Add SourceScope::inlined_instance 2022-07-08 09:19:07 +02:00
debuginfo.rs Add a distinct OperandValue::ZeroSized variant for ZSTs 2023-05-31 19:10:28 -07:00
intrinsic.rs remove unchecked_div/_rem from cg_ssa 2023-06-01 00:05:55 -07:00
mod.rs Add a distinct OperandValue::ZeroSized variant for ZSTs 2023-05-31 19:10:28 -07:00
operand.rs Add a distinct OperandValue::ZeroSized variant for ZSTs 2023-05-31 19:10:28 -07:00
place.rs Remove attempt to optimize codegen for discriminants. 2023-04-14 16:26:11 +00:00
rvalue.rs Add a distinct OperandValue::ZeroSized variant for ZSTs 2023-05-31 19:10:28 -07:00
statement.rs Refactor: Separate LocalRef variant for not-evaluated-yet operands 2023-03-24 20:36:59 -07:00