Skip to content

MIR const-prop not putting usize into AggregateKind::RawPtr? #124792

Description

@scottmcm

Discord Context: https://discord.com/channels/273534239310479360/273541522815713281/1236936970912137236

I was surprised in https://rust.godbolt.org/z/hnMT6K4qh to see

        _18 = const 128_usize;
        StorageLive(_24);
        _24 = _22 as *const () (PtrToPtr);
        _23 = *const [u8] from (_24, _18);

Because I would have expected constprop into the Aggregate, like

        StorageLive(_24);
        _24 = _22 as *const () (PtrToPtr);
        _23 = *const [u8] from (_24, const 128_usize);

As happened in other places, like

        _20 = Offset(_16, const 128_usize);
        StorageLive(_21);
        _21 = Sub(_13, const 128_usize);

AggregateKind::RawPtr is relatively new (#123840), so maybe it needs to be handled properly somewhere else?

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.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions