6.2: [CSE] Fix combine of type_value. #82700
Merged
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.
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. Buttype_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 twotype_value
s 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 )