Repository navigation
Cranelift: ISLE: Clif type args should always be controlling type - #15052
Merged
Merged
Conversation
Per discussion with cfallin, when a Clif ISLE term has a type (e.g. `(icmp ty x y)`, the type should be the controlling type from the Clif definition (here, the width of `x`/`y`), not the result type (here, `i8`) when they differ. Make this change and update the affected rules. Note this actually improves GVN due to it previously failing to deduplicate across the version of the instruction that correctly used the controlling type (before the egraph) and the one using the result type (in the egraph).
Subscribe to Label Actioncc @avanhatt, @cfallin, @fitzgen, @mmcloughlin DetailsThis issue or pull request has been labeled: "cranelift", "cranelift:meta", "isle"Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
cfallin
approved these changes
Oct 29, 2026
cfallin
left a comment
Member
There was a problem hiding this comment.
This looks correct to me, after going over the rule edits -- thanks for the careful work!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Per discussion with @cfallin, when a Clif ISLE term has a type parameter, the type should always be the controlling type from the Clif definition (e.g., the width of
x/yin(icmp ty x y)), not the result type (e.g.,i8) when they differ. Make this change and update the affected rules (257 of them) and ISLE specs. This requires introducing ahas_typehelper intooptfor cases where rules do intend to match on the result type.Note this had the nice consequence of improving GVN due to it previously failing to deduplicate across the version of the instruction that correctly used the controlling type (before the egraph) and the one using the result type (in the egraph). I have not yet tried to measure if this has any performance impact. This PR also fixes more cases where opt rules were only firing at
i8due to the conflation of the two types (related to #14964).