diff options
| author | Ben Kimock <kimockb@gmail.com> | 2023-03-24 12:35:16 -0400 |
|---|---|---|
| committer | Ben Kimock <kimockb@gmail.com> | 2023-03-24 12:35:16 -0400 |
| commit | 67540ec950b9bb5919c3c51dcf9fd6b3d380b7dc (patch) | |
| tree | eecee363dbdc325b03c6e0694db62f84d0407096 | |
| parent | a71b808d779d52cbddffe651eda761644cd9da70 (diff) | |
| download | rust-67540ec950b9bb5919c3c51dcf9fd6b3d380b7dc.tar.gz rust-67540ec950b9bb5919c3c51dcf9fd6b3d380b7dc.zip | |
Skip checks for common types with alignment 1
| -rw-r--r-- | compiler/rustc_mir_transform/src/check_alignment.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_mir_transform/src/check_alignment.rs b/compiler/rustc_mir_transform/src/check_alignment.rs index ee5272749fe..996416ef22e 100644 --- a/compiler/rustc_mir_transform/src/check_alignment.rs +++ b/compiler/rustc_mir_transform/src/check_alignment.rs @@ -99,6 +99,13 @@ impl<'tcx, 'a> Visitor<'tcx> for PointerFinder<'tcx, 'a> { return; } + if [self.tcx.types.bool, self.tcx.types.i8, self.tcx.types.u8, self.tcx.types.str_] + .contains(&pointee_ty) + { + debug!("Trivially aligned pointee type: {:?}", pointer_ty); + return; + } + self.pointers.push((pointer, pointee_ty)) } } |
