-
Notifications
You must be signed in to change notification settings - Fork 1.7k
C++: Handle Arm SVE in the IR #19845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds support for Arm Scalable Vector Extension (SVE) types in the intermediate representation generation and updates related tests.
- Renames and extends NEON tests (
arm.cpp
→arm_neon.cpp
) and adds a newarm_sve.cpp
test. - Updates expected IR and AST outputs for both NEON and SVE patterns.
- Treats
ScalableVectorType
as opaque (size 0) and includes it in const-propagation (isDeeplyConstBelow
) rules in the QL IR definitions.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
cpp/ql/test/library-tests/ir/ir/raw_ir.expected | Updated expected raw IR for NEON and added SVE cases |
cpp/ql/test/library-tests/ir/ir/aliased_ir.expected | Updated aliased IR expectations for NEON and SVE |
cpp/ql/test/library-tests/ir/ir/PrintAST.expected | Updated AST print expectations for NEON and SVE |
cpp/ql/test/library-tests/ir/ir/arm_neon.cpp | New NEON test source |
cpp/ql/test/library-tests/ir/ir/arm_sve.cpp | New SVE test source |
cpp/ql/lib/semmle/code/cpp/ir/internal/CppType.qll | Treat ScalableVectorType as size-0 in getTypeSizeWorkaround and isOpaqueType |
cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/SideEffects.qll | Include ScalableVectorType in isDeeplyConstBelow |
Comments suppressed due to low confidence (2)
cpp/ql/lib/semmle/code/cpp/ir/internal/CppType.qll:34
- [nitpick] Add a QLDoc comment above this clause to explain why
ScalableVectorType
is treated as size 0 (opaque) and when this fallback might need revisiting.
type instanceof ScalableVectorType and
cpp/ql/lib/semmle/code/cpp/ir/internal/CppType.qll:34
- Add or extend a unit test to verify that
getTypeSizeWorkaround
returns 0 forScalableVectorType
, ensuring the new fallback is exercised.
type instanceof ScalableVectorType and
isDeeplyConst(t.(GNUVectorType).getBaseType()) | ||
or | ||
isDeeplyConst(t.(ScalableVectorType).getBaseType()) | ||
or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider grouping the vector-type const checks (GNUVectorType and ScalableVectorType) into a single reusable predicate to reduce duplication.
isDeeplyConst(t.(GNUVectorType).getBaseType()) | |
or | |
isDeeplyConst(t.(ScalableVectorType).getBaseType()) | |
or | |
isVectorType(t) and isDeeplyConst(t.getBaseType()) | |
or |
Copilot uses AI. Check for mistakes.
Observe that MS calculator is currently broken in DCA. I don't think missing out on the project is critical for this PR. I've opened microsoft/calculator#2347 to hopefully get this resolved.