Auto merge of #105582 - saethlin:instcombine-assert-inhabited, r=cjgillot
InstCombine away intrinsic validity assertions This optimization (currently) fires 246 times on the standard library. It seems to fire hardly at all on the big crates in the benchmark suite. Interesting.
This commit is contained in:
commit
885bf62887
12 changed files with 276 additions and 16 deletions
|
@ -678,8 +678,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
|||
let layout = bx.layout_of(ty);
|
||||
let do_panic = match intrinsic {
|
||||
Inhabited => layout.abi.is_uninhabited(),
|
||||
ZeroValid => !bx.tcx().permits_zero_init(layout),
|
||||
MemUninitializedValid => !bx.tcx().permits_uninit_init(layout),
|
||||
ZeroValid => !bx.tcx().permits_zero_init(bx.param_env().and(layout)),
|
||||
MemUninitializedValid => !bx.tcx().permits_uninit_init(bx.param_env().and(layout)),
|
||||
};
|
||||
Some(if do_panic {
|
||||
let msg_str = with_no_visible_paths!({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue