C++: Add Arm scalable vector type QL classes#19792
Merged
jketema merged 4 commits intogithub:mainfrom Jun 18, 2025
Merged
Conversation
7f9dd16 to
850779c
Compare
8cd78be to
f579099
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for Arm scalable vector extensions by extending the database schema, introducing new QL classes, and updating tests to recognize the new types.
- Define new built-in type kind for
__SVCount_tand derived type kind for scalable vectors - Add
tupleelementstable and implementScalableVectorCount/ScalableVectorTypein QL - Update library-tests to include
__SVCount_tin various expected outputs
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| cpp/ql/test/library-tests/variables/variables/types.expected | Add expected entry for __SVCount_t as ScalableVectorCount |
| cpp/ql/test/library-tests/unspecified_type/types/unspecified_type.expected | Include __SVCount_t in unspecified-type tests |
| cpp/ql/test/library-tests/type_sizes/type_sizes.expected | Record size (0) for __SVCount_t |
| cpp/ql/test/library-tests/templates/type_instantiations/types.expected | Add __SVCount_t to template instantiation tests |
| cpp/ql/lib/upgrades/9baef67d1ffc1551429dbe1c1130815693e28218/upgrade.properties | Declare Arm scalable vector support upgrade |
| cpp/ql/lib/semmlecode.cpp.dbscheme | Introduce kinds @scalable_vector_count (63) and @scalable_vector (11) |
| cpp/ql/lib/semmle/code/cpp/ir/internal/CppType.qll | Treat ScalableVectorCount as opaque in size queries |
| cpp/ql/lib/semmle/code/cpp/Type.qll | Add ScalableVectorCount and ScalableVectorType classes; exclude count type from arithmetic |
| cpp/downgrades/e38346051783182ea75822e4adf8d4c6a949bc37/upgrade.properties | Define downgrade for scalable vector support |
| cpp/downgrades/e38346051783182ea75822e4adf8d4c6a949bc37/derivedtypes.ql | Map scalable vector kind back to GNU vector on downgrade |
| cpp/downgrades/e38346051783182ea75822e4adf8d4c6a949bc37/builtintypes.ql | Map __SVCount_t kind to error on downgrade |
cpp/ql/lib/upgrades/9baef67d1ffc1551429dbe1c1130815693e28218/upgrade.properties
Show resolved
Hide resolved
IdrissRio
reviewed
Jun 18, 2025
| @@ -134,6 +134,8 @@ private predicate isOpaqueType(Type type) { | |||
| ) | |||
Contributor
There was a problem hiding this comment.
I'm not sure, but shouldn't we treat ScalableVectorType similarly to , e.g., GNUVectorType?
Suggested change
| ) | |
| type instanceof ScalableVectorType | |
| ) |
Contributor
Author
There was a problem hiding this comment.
Probably. Writing IR tests is on the to-do list as a follow-up. The below was just need to make sure the tests don't fall over, because ScalableVectorCount has no size. So fixing or adapting this I would like to postpone once I have some time to write some tests.
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.
Update the database scheme to support Arm scalable vector extensions. Also introduce relevant QL classes for the scalable vector type.
I would like to omit a change note here, as users cannot extract these types at the moment. It seems more appropriate to write a single change note once that is possible.