Skip to content

make small (<= size_of::<int>()) tuples immediate - #9656

Merged
bors merged 1 commit into
rust-lang:masterfrom
thestinger:immediate
Oct 2, 2013
Merged

make small (<= size_of::<int>()) tuples immediate#9656
bors merged 1 commit into
rust-lang:masterfrom
thestinger:immediate

Conversation

@thestinger

Copy link
Copy Markdown
Contributor
fn foo() -> (u32, u8, u8, u8, u8) {
    (4, 5, 6, 7, 8)
}

Before:

; Function Attrs: nounwind uwtable
define void @_ZN3foo18hbb616262f874f8daf4v0.0E({ i32, i8, i8, i8, i8 }* noalias nocapture sret, { i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
"function top level":
  %2 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 0
  store i32 4, i32* %2, align 4
  %3 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 1
  store i8 5, i8* %3, align 4
  %4 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 2
  store i8 6, i8* %4, align 1
  %5 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 3
  store i8 7, i8* %5, align 2
  %6 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 4
  store i8 8, i8* %6, align 1
  ret void
}

After:

; Function Attrs: nounwind readnone uwtable
define { i32, i8, i8, i8, i8 } @_ZN3foo18hbb616262f874f8daf4v0.0E({ i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
"function top level":
  ret { i32, i8, i8, i8, i8 } { i32 4, i8 5, i8 6, i8 7, i8 8 }
}

@thestinger

Copy link
Copy Markdown
Contributor Author

I am still having a bit of trouble tracking down problematic struct and enum code paths, so we'll start with this.

    fn foo() -> (u32, u8, u8, u8, u8) {
        (4, 5, 6, 7, 8)
    }

Before:

    ; Function Attrs: nounwind uwtable
    define void @_ZN3foo18hbb616262f874f8daf4v0.0E({ i32, i8, i8, i8, i8 }* noalias nocapture sret, { i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
    "function top level":
      %2 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 0
      store i32 4, i32* %2, align 4
      %3 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 1
      store i8 5, i8* %3, align 4
      %4 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 2
      store i8 6, i8* %4, align 1
      %5 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 3
      store i8 7, i8* %5, align 2
      %6 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 4
      store i8 8, i8* %6, align 1
      ret void
    }

After:

    ; Function Attrs: nounwind readnone uwtable
    define { i32, i8, i8, i8, i8 } @_ZN3foo18hbb616262f874f8daf4v0.0E({ i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
    "function top level":
      ret { i32, i8, i8, i8, i8 } { i32 4, i8 5, i8 6, i8 7, i8 8 }
    }
bors added a commit that referenced this pull request Oct 2, 2013
    fn foo() -> (u32, u8, u8, u8, u8) {
        (4, 5, 6, 7, 8)
    }

Before:

    ; Function Attrs: nounwind uwtable
    define void @_ZN3foo18hbb616262f874f8daf4v0.0E({ i32, i8, i8, i8, i8 }* noalias nocapture sret, { i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
    "function top level":
      %2 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 0
      store i32 4, i32* %2, align 4
      %3 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 1
      store i8 5, i8* %3, align 4
      %4 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 2
      store i8 6, i8* %4, align 1
      %5 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 3
      store i8 7, i8* %5, align 2
      %6 = getelementptr inbounds { i32, i8, i8, i8, i8 }* %0, i64 0, i32 4
      store i8 8, i8* %6, align 1
      ret void
    }

After:

    ; Function Attrs: nounwind readnone uwtable
    define { i32, i8, i8, i8, i8 } @_ZN3foo18hbb616262f874f8daf4v0.0E({ i64, %tydesc*, i8*, i8*, i8 }* nocapture readnone) #0 {
    "function top level":
      ret { i32, i8, i8, i8, i8 } { i32 4, i8 5, i8 6, i8 7, i8 8 }
    }
@bors bors closed this Oct 2, 2013
@bors
bors merged commit 5e4ae4f into rust-lang:master Oct 2, 2013
@thestinger
thestinger deleted the immediate branch October 2, 2013 07:34
U007D pushed a commit to U007D/rust-mos that referenced this pull request Aug 21, 2026
9656: Revert rust-lang#9655 because it breaks some type inference r=flodiebold a=flodiebold

This reverts commit 8c8c6fb, reversing
changes made to ec7b4cb.

bors r+

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants