-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't use dropflag hints when the type is dropless #30851
Merged
Merged
Conversation
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
(rust_highfive has picked a reviewer for you, use r? to override) |
r? @pnkfelix |
Ironically this same bug was just pointed out to me at lunch today. (I didn't have time to investigate as i have hands full with regression fixes at moment but will review this ASAP) |
@bors r+ |
📌 Commit e3abc3c has been approved by |
Manishearth
added a commit
to Manishearth/rust
that referenced
this pull request
Jan 14, 2016
… r=pnkfelix Apparently we allocate and maintain non-working dropflag hints since June... In anticipation of a working implementation of on-stack drop flag hints, let's not spend even more time on types that don't even need to be dropped. ```rust fn main() { let (i,j,k,l) = (0,0,0,0); } ``` used to translate to (unoptimized only, of course): ```llvm define internal void @_ZN4main20ha8deb085c47920d8eaaE() unnamed_addr #0 { entry-block: %dropflag_hint_10 = alloca i8 %dropflag_hint_11 = alloca i8 %dropflag_hint_12 = alloca i8 %dropflag_hint_13 = alloca i8 %const = alloca { i32, i32, i32, i32 } %i = alloca i32 %j = alloca i32 %k = alloca i32 %l = alloca i32 store i8 61, i8* %dropflag_hint_10 store i8 61, i8* %dropflag_hint_11 store i8 61, i8* %dropflag_hint_12 store i8 61, i8* %dropflag_hint_13 %0 = bitcast { i32, i32, i32, i32 }* %const to i8* call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* bitcast ({ i32, i32, i32, i32 }* @const2752 to i8*), i64 16, i32 4, i1 false) %1 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 0 %2 = load i32, i32* %1, align 4 store i32 %2, i32* %i, align 4 %3 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 1 %4 = load i32, i32* %3, align 4 store i32 %4, i32* %j, align 4 %5 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 2 %6 = load i32, i32* %5, align 4 store i32 %6, i32* %k, align 4 %7 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 3 %8 = load i32, i32* %7, align 4 store i32 %8, i32* %l, align 4 ret void } ``` Now it gives: ```llvm define internal void @_ZN4main20ha8deb085c47920d8eaaE() unnamed_addr #0 { entry-block: %const = alloca { i32, i32, i32, i32 } %i = alloca i32 %j = alloca i32 %k = alloca i32 %l = alloca i32 %0 = bitcast { i32, i32, i32, i32 }* %const to i8* call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* bitcast ({ i32, i32, i32, i32 }* @const2748 to i8*), i64 16, i32 4, i1 false) %1 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 0 %2 = load i32, i32* %1, align 4 store i32 %2, i32* %i, align 4 %3 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 1 %4 = load i32, i32* %3, align 4 store i32 %4, i32* %j, align 4 %5 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 2 %6 = load i32, i32* %5, align 4 store i32 %6, i32* %k, align 4 %7 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 3 %8 = load i32, i32* %7, align 4 store i32 %8, i32* %l, align 4 ret void } ``` Let's hope I didn't break anything!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Apparently we allocate and maintain non-working dropflag hints since June... In anticipation of a working implementation of on-stack drop flag hints, let's not spend even more time on types that don't even need to be dropped.
used to translate to (unoptimized only, of course):
Now it gives:
Let's hope I didn't break anything!