Skip to content

Cleanup nullary operator handling #146411

@RalfJung

Description

@RalfJung

@oli-obk recently cleaned up our nullary intrinsics so that the backends now only ever see them as constants. This is nice because

  • we don't need a codepath for each backend
  • even MIR optimizations can now see and reason about the values of these operators without special support

However, we still have some "nullary operators" in MIR that

  • are implemented in each backend
  • and in fact also have an implementation duplicated across multiple MIR opts (dataflow_const_prop, gvn, known_panics_lint)

It would be nice to also clean those up. It is fairly easy to move the direct invocations of the corresponding intrinsics into const blocks, but IIRC some of these nullary ops are also use by some MIR shims and that would then be more difficult to handle. (But I am not sure about this, I may entirely misremember why we added NullaryOp in the first place.)

Cc @scottmcm @rust-lang/wg-mir-opt

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlC-cleanupCategory: PRs that clean code up or issues documenting cleanup.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-mir-optWorking group: MIR optimizations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions