Skip to content
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

Make omission of impossible if-else branches work with constants #8041

Closed
wants to merge 3 commits into from

Conversation

dotdash
Copy link
Contributor

@dotdash dotdash commented Jul 25, 2013

No description provided.

dotdash added 2 commits July 25, 2013 12:06
Until now, we only optimized away impossible branches when there is a
literal true/false in the code. But since the LLVM IR builder already does
constant folding for us, we can trivially expand that to work with
constants as well.

Refs rust-lang#7834
@brendanzab
Copy link
Member

Could you add some tests for this?

@thestinger
Copy link
Contributor

@bjz: I don't think we have a way to test it yet, without emitted IR tests.

We already avoid the conditional branch, but still have an
unconditional branch in the generated code. Remove it.
@alexcrichton
Copy link
Member

@thestinger I think we can inside of src/test/codegen. They'll only test that the IR ratio doesn't get worse than it currently is, but it's probably a good idea regardless.

@bors bors closed this Jul 26, 2013
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.

6 participants