Rollup merge of #125796 - scottmcm:more-inst-simplify, r=oli-obk
Also InstSimplify `&raw*` We do this for `&*` and `&mut*` already; might as well do it for raw pointers too. r? mir-opt
This commit is contained in:
commit
234ed6ae5b
4 changed files with 157 additions and 1 deletions
|
@ -123,7 +123,7 @@ impl<'tcx> InstSimplifyContext<'tcx, '_> {
|
|||
|
||||
/// Transform `&(*a)` ==> `a`.
|
||||
fn simplify_ref_deref(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) {
|
||||
if let Rvalue::Ref(_, _, place) = rvalue {
|
||||
if let Rvalue::Ref(_, _, place) | Rvalue::AddressOf(_, place) = rvalue {
|
||||
if let Some((base, ProjectionElem::Deref)) = place.as_ref().last_projection() {
|
||||
if rvalue.ty(self.local_decls, self.tcx) != base.ty(self.local_decls, self.tcx).ty {
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue