Skip to content

[SR-8272] Drop the last remnants of LogicValue #21451

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
Dec 21, 2018
Merged

Conversation

CodaFi
Copy link
Contributor

@CodaFi CodaFi commented Dec 20, 2018

Removes the _getBuiltinLogicValue intrinsic in favor of an open-coded struct_extract in SIL. This removes Sema's last non-literal use of builtin integer types and unblocks a bunch of cleanup.

This patch would be NFC, but it improves line information for conditional expression codegen.

Resolves SR-8272.

Since this seems to have hit the trifecta of ABI change, compiler change, and stdlib change: lots of reviews please. This oughta go into 5.0 as well.

@CodaFi
Copy link
Contributor Author

CodaFi commented Dec 20, 2018

@swift-ci please smoke test

@CodaFi
Copy link
Contributor Author

CodaFi commented Dec 20, 2018

@swift-ci please test source compatibility

@slavapestov
Copy link
Contributor

I don’t think this is an ABI change; you’re only removing a transparent function so it should have been inlined away. It’s up to you if you want to push for this to go into 5.0 or not, but my gut feeling is to be conservative and leave it on master.

@Azoy weren’t you working on something similar recently?

Removes the _getBuiltinLogicValue intrinsic in favor of an open-coded
struct_extract in SIL.  This removes Sema's last non-literal use of builtin
integer types and unblocks a bunch of cleanup.

This patch would be NFC, but it improves line information for conditional expression codegen.
@Azoy
Copy link
Contributor

Azoy commented Dec 20, 2018

Yeah I had something similar here: #21285, but this patch seems successful in removing this logic from Sema and into SILGen.

@Azoy
Copy link
Contributor

Azoy commented Dec 20, 2018

While I don't think this affects ABI (because transparent), I think it is still a good candidate for the 5.0 branch because I don't think we really want users to be able to access this function as an API.

let x = true._getBuiltinLogicValue() // ok

The same could be said about the _getBool function I removed not to long ago as well.

let x = true._getBuiltinLogicValue() // ok
let y = _getBool(x) // ok

@CodaFi
Copy link
Contributor Author

CodaFi commented Dec 20, 2018

Source Compatibility passed (https://ci.swift.org/job/swift-PR-source-compat-suite/2331/ and https://ci.swift.org/job/swift-PR-source-compat-suite-debug/557/). Fixing the API digester tests.

@CodaFi
Copy link
Contributor Author

CodaFi commented Dec 20, 2018

@swift-ci please smoke test

@CodaFi
Copy link
Contributor Author

CodaFi commented Dec 20, 2018

LLDB's failing. Will try again in the morning.

@jrose-apple
Copy link
Contributor

Technically transparent functions are only inlined away when called immediately, but this particular function is almost certainly never not called immediately.

@CodaFi
Copy link
Contributor Author

CodaFi commented Dec 20, 2018

@swift-ci please smoke test

@CodaFi
Copy link
Contributor Author

CodaFi commented Dec 20, 2018

Still want core team member sign-off on this and plans to push these to 5.0.

@DougGregor, @airspeedswift?

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

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

This is a very nice improvement. I don't think it change the ABI in practical terms because of the @transparent, but I would like to get it into 5.0 if we can. Let's get it merged to master and cherry-pick for 5.0.

@CodaFi
Copy link
Contributor Author

CodaFi commented Dec 21, 2018

⛵️

@CodaFi CodaFi merged commit 2efbeb3 into swiftlang:master Dec 21, 2018
@CodaFi CodaFi deleted the logicd branch December 21, 2018 04:33
@DougGregor
Copy link
Member

@CodaFi will you cherry-pick for the 5.0 branch?

@CodaFi
Copy link
Contributor Author

CodaFi commented Dec 21, 2018

Cherry picking as I type.

@Azoy
Copy link
Contributor

Azoy commented Dec 21, 2018

@DougGregor slightly off topic for this pr, but because this is making it in the 5.0 branch, could the removal of the _getBool intrinsic also make sense for the 5.0 branch?

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.

5 participants