Skip to content

SROA is incompatible with RFC 3943 semantics #163388

Description

@tmiasko
#![feature(custom_mir, core_intrinsics)]
#![allow(internal_features)]
use std::intrinsics::mir::*;
use std::mem::MaybeUninit;
#[custom_mir(dialect = "runtime")]
pub fn main() {
    mir! {
        let _1: (usize, MaybeUninit<usize>);
        let _2: MaybeUninit<usize>;
        {
            _1.0 = 0;
            _2 = _1.1;
            Return()
        }
    }
}

rustc --crate-type=lib a.rs -Zunpretty=mir -Zmir-opt-level=0 -Zmir-enable-passes=+ScalarReplacementOfAggregates

// WARNING: This output format is intended for human consumers only
// and is subject to change without notice. Knock yourself out.
// HINT: See also -Z dump-mir for MIR at specific points during compilation.
fn main() -> () {
    let mut _0: ();
    let mut _1: (usize, std::mem::MaybeUninit<usize>);
    let mut _2: std::mem::MaybeUninit<usize>;
    let mut _3: usize;
    let mut _4: std::mem::MaybeUninit<usize>;

    bb0: {
        _3 = const 0_usize;
        _2 = copy _4;
        return;
    }
}

cc @Amanieu

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-mir-optArea: MIR optimizationsC-bugCategory: This is a bug.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions