Also InstSimplify &raw*
We do this for `&*` and `&mut*` already; might as well do it for raw pointers too.
This commit is contained in:
parent
366da30d55
commit
4b96e44ebb
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