Skip to content

Properly translate boolean statics to be stored as i8 #17875

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

Merged
merged 1 commit into from
Oct 9, 2014

Conversation

dotdash
Copy link
Contributor

@dotdash dotdash commented Oct 8, 2014

While booleans are represented as i1 in SSA values, LLVM expects them
to be stored/loaded as i8 values. Using i1 as we do now works, but
kills some optimizations, so we should switch to i8, just like we do
everywhere else.

Fixes #16959.

@alexcrichton
Copy link
Member

Could you add a test for this as well?

llvm::LLVMInt8TypeInContext(ccx.llcx())
} else {
llvm::LLVMTypeOf(v)
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment about what translation is going on here?

@alexcrichton
Copy link
Member

Thanks! r=me with some comments and some tests

@alexcrichton
Copy link
Member

I have misread the issue! r=me with some comments (no tests necessary)

While booleans are represented as i1 in SSA values, LLVM expects them
to be stored/loaded as i8 values. Using i1 as we do now works, but
kills some optimizations, so we should switch to i8, just like we do
everywhere else.

Fixes rust-lang#16959.
bors added a commit that referenced this pull request Oct 9, 2014
While booleans are represented as i1 in SSA values, LLVM expects them
to be stored/loaded as i8 values. Using i1 as we do now works, but
kills some optimizations, so we should switch to i8, just like we do
everywhere else.

Fixes #16959.
@bors bors closed this Oct 9, 2014
@bors bors merged commit 6fa5a2f into rust-lang:master Oct 9, 2014
@dotdash dotdash deleted the static_bool branch February 4, 2015 12:42
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.

Statics loads from immutable statics are only sometimes eliminated
4 participants