forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auto merge of rust-lang#15076 : luqmana/rust/naim, r=pcwalton
```Rust struct With { x: int, f: NoCopy } #[no_mangle] fn bar() { let mine = With { x: 3, f: NoCopy }; match mine { c => { foo(c); } } } #[no_mangle] fn foo(_: With) {} ``` Before: ```LLVM define internal void @bar() unnamed_addr #1 { entry-block: %mine = alloca %"struct.With<[]>" %__llmatch = alloca %"struct.With<[]>"* %c = alloca %"struct.With<[]>" %0 = getelementptr inbounds %"struct.With<[]>"* %mine, i32 0, i32 0 store i64 3, i64* %0 %1 = getelementptr inbounds %"struct.With<[]>"* %mine, i32 0, i32 1 store %"struct.With<[]>"* %mine, %"struct.With<[]>"** %__llmatch br label %case_body case_body: ; preds = %entry-block %2 = load %"struct.With<[]>"** %__llmatch %3 = bitcast %"struct.With<[]>"* %2 to i8* %4 = bitcast %"struct.With<[]>"* %c to i8* call void @llvm.memcpy.p0i8.p0i8.i64(i8* %4, i8* %3, i64 8, i32 8, i1 false) %5 = load %"struct.With<[]>"* %c call void @foo(%"struct.With<[]>" %5) br label %join join: ; preds = %case_body ret void } ``` After: ```LLVM define internal void @bar() unnamed_addr #1 { entry-block: %mine = alloca %"struct.With<[]>" %c = alloca %"struct.With<[]>"* %0 = getelementptr inbounds %"struct.With<[]>"* %mine, i32 0, i32 0 store i64 3, i64* %0 %1 = getelementptr inbounds %"struct.With<[]>"* %mine, i32 0, i32 1 store %"struct.With<[]>"* %mine, %"struct.With<[]>"** %c br label %case_body case_body: ; preds = %entry-block %2 = load %"struct.With<[]>"** %c %3 = load %"struct.With<[]>"* %2 call void @foo(%"struct.With<[]>" %3) br label %join join: ; preds = %case_body ret void } ``` r? @pcwalton
- Loading branch information
Showing
3 changed files
with
89 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters