Fix invalid module bitcode when indexing a swizzled bool vector#6582
Merged
amaiorano merged 2 commits intomicrosoft:mainfrom May 9, 2024
Merged
Conversation
Collaborator
Author
|
See this example of the failure: https://godbolt.org/z/WsajscbT9 |
llvm-beanz
reviewed
May 3, 2024
llvm-beanz
reviewed
May 3, 2024
When indexing a swizzled bool vector, some HLSL-specific code in EmitCXXMemberOrOperatorMemberCallExpr kicks in to handle the HLSLVecType. In this case, we’re dealing with an ExtVectorElt because of the swizzle, so this function creates a GEP, Load, and Store on the vector. However, we need to truncate the loaded value from i32 to i1, otherwise we attempt to write an i32 to an i1, which trips the assert.
36a8db0 to
15e180b
Compare
llvm-beanz
reviewed
May 7, 2024
llvm-beanz
reviewed
May 7, 2024
Collaborator
llvm-beanz
left a comment
There was a problem hiding this comment.
I think this looks good, but since I contributed a bit to it I want to get some additional eyes on it.
Collaborator
|
LGTM |
farzonl
approved these changes
May 7, 2024
tex3d
reviewed
May 7, 2024
llvm-beanz
reviewed
May 7, 2024
llvm-beanz
approved these changes
May 9, 2024
qtprojectorg
pushed a commit
to qt/qtwebengine-chromium
that referenced
this pull request
Sep 18, 2024
Manual cherry-pick of patch originally reviewed on microsoft/DirectXShaderCompiler#6582: Fix invalid module bitcode when indexing a swizzled bool vector (#6582) When indexing a swizzled bool vector, some HLSL-specific code in EmitCXXMemberOrOperatorMemberCallExpr kicks in to handle the HLSLVecType. In this case, we’re dealing with an ExtVectorElt because of the swizzle, so this function creates a GEP, Load, and Store on the vector. However, boolean scalars are returned as type i11 while the store is storing to a bool, which is an i32, so we need to insert a cast before the store. Change-Id: I4e2b8a46d4df29f7bbf24738509ff9095a31d8bf Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/591596 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
qtprojectorg
pushed a commit
to qt/qtwebengine-chromium
that referenced
this pull request
Sep 18, 2024
Manual cherry-pick of patch originally reviewed on microsoft/DirectXShaderCompiler#6582: Fix invalid module bitcode when indexing a swizzled bool vector (#6582) When indexing a swizzled bool vector, some HLSL-specific code in EmitCXXMemberOrOperatorMemberCallExpr kicks in to handle the HLSLVecType. In this case, we’re dealing with an ExtVectorElt because of the swizzle, so this function creates a GEP, Load, and Store on the vector. However, boolean scalars are returned as type i11 while the store is storing to a bool, which is an i32, so we need to insert a cast before the store. Change-Id: I4e2b8a46d4df29f7bbf24738509ff9095a31d8bf Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/591589 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
SjMxr233
pushed a commit
to ShaderHelper/DirectXShaderCompiler
that referenced
this pull request
Jul 24, 2025
…osoft#6582) When indexing a swizzled bool vector, some HLSL-specific code in EmitCXXMemberOrOperatorMemberCallExpr kicks in to handle the HLSLVecType. In this case, we’re dealing with an ExtVectorElt because of the swizzle, so this function creates a GEP, Load, and Store on the vector. However, boolean scalars are returned as type i11 while the store is storing to a bool, which is an i32, so we need to insert a cast before the store.
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.
When indexing a swizzled bool vector, some HLSL-specific code in EmitCXXMemberOrOperatorMemberCallExpr kicks in to handle the HLSLVecType. In this case, we’re dealing with an ExtVectorElt because of the swizzle, so this function creates a GEP, Load, and Store on the vector. However, boolean scalars are returned as type i11 while the store is storing to a bool, which is an i32, so we need to insert a cast before the store.