Skip to content

Commit

Permalink
Don't avoid bool tags anymore to use scalar pairs for tagged enums
Browse files Browse the repository at this point in the history
  • Loading branch information
nox committed Apr 27, 2018
1 parent fd1b258 commit 666ddd8
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/librustc/ty/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -988,13 +988,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
let mut abi = Abi::Aggregate { sized: true };
if tag.value.size(dl) == size {
abi = Abi::Scalar(tag.clone());
} else if !tag.is_bool() {
// HACK(nox): Blindly using ScalarPair for all tagged enums
// where applicable leads to Option<u8> being handled as {i1, i8},
// which later confuses SROA and some loop optimisations,
// ultimately leading to the repeat-trusted-len test
// failing. We make the trade-off of using ScalarPair only
// for types where the tag isn't a boolean.
} else {
let mut common_prim = None;
for (field_layouts, layout_variant) in variants.iter().zip(&layout_variants) {
let offsets = match layout_variant.fields {
Expand Down

0 comments on commit 666ddd8

Please sign in to comment.