Skip to content

Cranelift: ISLE: Clif type args should always be controlling type - #15052

Merged
cfallin merged 1 commit into
bytecodealliance:mainfrom
avanhatt:isle-ctrl-ty
Oct 29, 2026
Merged

cfallin merged 1 commit into
bytecodealliance:mainfrom
avanhatt:isle-ctrl-ty

Conversation

@avanhatt

Copy link
Copy Markdown
Member

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/y in (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 a has_type helper into opt for 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 i8 due to the conflation of the two types (related to #14964).

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).
@avanhatt
avanhatt requested a review from a team as a code owner October 28, 2026 21:03
@avanhatt
avanhatt requested review from fitzgen and removed request for a team October 28, 2026 21:04
@github-actions github-actions Bot added cranelift Issues related to the Cranelift code generator cranelift:meta Everything related to the meta-language. isle Related to the ISLE domain-specific language labels Oct 28, 2026
@github-actions

Copy link
Copy Markdown

Subscribe to Label Action

cc @avanhatt, @cfallin, @fitzgen, @mmcloughlin

Details This issue or pull request has been labeled: "cranelift", "cranelift:meta", "isle"

Thus the following users have been cc'd because of the following labels:

  • avanhatt: isle
  • cfallin: isle
  • fitzgen: isle
  • mmcloughlin: isle

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

@cfallin cfallin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks correct to me, after going over the rule edits -- thanks for the careful work!

@cfallin
cfallin added this pull request to the merge queue Oct 29, 2026
Merged via the queue into bytecodealliance:main with commit bcc6af9 Oct 29, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cranelift:meta Everything related to the meta-language. cranelift Issues related to the Cranelift code generator isle Related to the ISLE domain-specific language

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants