Skip to content

use information about non-raw pointers being non-null #9546

Closed
@thestinger

Description

@thestinger

We can set this in arbitrary metadata, and then write an LLVM pass to consume it and mark them as non-null.

This is awful:

pub fn foo(x: &int) -> bool {
    Some(x) == None
}
; Function Attrs: nounwind readonly uwtable
define i8 @_ZN3foo19h6e99b0040329bc59af4v0.0E({ i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone, i64*) unnamed_addr #0 {
entry-block:
  %2 = icmp eq i64* %1, null
  %. = zext i1 %2 to i8
  ret i8 %.
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.I-slowIssue: Problems and improvements with respect to performance of generated code.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions