Skip to content

Conversation

tommymcm
Copy link
Collaborator

@tommymcm tommymcm commented Jul 2, 2025

The cir::CastOp::verify method was overly conservative, and would fail on any bitcast from vector to scalar or scalar to vector.

Change List:

  • Extends the cir::CastOp::verify method to check if the source and result types are the same size using the mlir::DataLayout of the current scope, and succeeds if the sizes match.
  • Extends the CodeGen vectype tests with vector to scalar, scalar to vector and vector to vector conversions.
  • Extends the IR invalid tests with vector to scalar and scalar to vector conversions with different source and result sizes.

… of the same size.

The `cir::CastOp::verify` method was overly conservative, and would fail on any `bitcast` from vector to scalar or scalar to vector.
This diff extends the `cir::CastOp::verify` method to check if the source and result types are the same size using the `mlir::DataLayout` of the current scope, and succeeds if the sizes match.
This diff also extends the CodeGen vectype tests with vector to scalar, scalar to vector and vector to vector conversions.
This diff also extends the IR invalid tests with vector to scalar and scalar to vector	conversions with different source and result sizes.
Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

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

Awesome, thanks Tommy!

@bcardosolopes bcardosolopes merged commit 60da1a4 into llvm:main Jul 2, 2025
9 of 10 checks passed
terapines-osc-cir pushed a commit to Terapines/clangir that referenced this pull request Sep 2, 2025
… of the same size (llvm#1728)

The `cir::CastOp::verify` method was overly conservative, and would fail
on any `bitcast` from vector to scalar or scalar to vector.

Change List:
- Extends the `cir::CastOp::verify` method to check if the source and
result types are the same size using the `mlir::DataLayout` of the
current scope, and succeeds if the sizes match.
- Extends the CodeGen vectype tests with vector to scalar, scalar to
vector and vector to vector conversions.
- Extends the IR invalid tests with vector to scalar and scalar to
vector conversions with different source and result sizes.
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