Skip to content

6.2: [CSE] Fix combine of type_value. #82700

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

Conversation

nate-chandler
Copy link
Contributor

@nate-chandler nate-chandler commented Jul 1, 2025

Explanation: Fix a miscompile of value generics.

CSE deduplicates instructions, substituting one for another and deleting the other. When doing this, it must prove that the instructions are the same.

Previously, it was determining that two type_value instructions were the same when they had the same type and the same operands. But type_value has no operands; instead, it has a second "param type", which refers to the value generic in the function signature. CSE was disregarding when two type_values had different param types. The result was to replace one value generic with another.

Here, this is fixed by considering the type and the param type both in hashing and equality checking.
Scope: Affects optimized code with value generics.
Issue: rdar://154652254
Original PR: #82696
Risk: Low, this is a narrow fix that only affects value generics.
Testing: Added test.
Reviewer: Meghana Gupta ( @meg-gupta ), Andrew Trick ( @atrick )

The instruction has no operands but has a param type.  Hash and compare
the type and the type and the param type.

rdar://154652254
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler nate-chandler marked this pull request as ready for review July 2, 2025 23:50
@nate-chandler nate-chandler requested a review from a team as a code owner July 2, 2025 23:50
@nate-chandler nate-chandler enabled auto-merge July 2, 2025 23:50
@nate-chandler nate-chandler merged commit e3f8048 into swiftlang:release/6.2 Jul 2, 2025
5 checks passed
@nate-chandler nate-chandler deleted the cherrypick/release/6.2/rdar154652254 branch July 2, 2025 23:52
@tbkka
Copy link
Contributor

tbkka commented Jul 2, 2025

Ouch. I'm glad we found this one.

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.

2 participants