diff options
author | Sarah Spall <sarahspall@microsoft.com> | 2025-04-02 12:27:01 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-02 12:27:01 -0700 |
commit | 60efed3f2025cc9612570487dba5cb299ee28167 (patch) | |
tree | c675e145710867bf081103af37c8e8185d288d53 /clang/lib/CodeGen | |
parent | 843ef77dc22afd1923b891acd4c46c8f8c8c93ae (diff) | |
download | llvm-60efed3f2025cc9612570487dba5cb299ee28167.zip llvm-60efed3f2025cc9612570487dba5cb299ee28167.tar.gz llvm-60efed3f2025cc9612570487dba5cb299ee28167.tar.bz2 |
[HLSL] Update __builtin_hlsl_dot builtin Sema Checking to fix error when passed an array literal 1u.xxxx (#133941)
update dot builtin sema checking and codegen
new test
fix tests
Closes #133659
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGHLSLBuiltins.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/clang/lib/CodeGen/CGHLSLBuiltins.cpp b/clang/lib/CodeGen/CGHLSLBuiltins.cpp index 136ea47..99c6280 100644 --- a/clang/lib/CodeGen/CGHLSLBuiltins.cpp +++ b/clang/lib/CodeGen/CGHLSLBuiltins.cpp @@ -368,20 +368,12 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID, "Scalar dot product is only supported on ints and floats."); } // For vectors, validate types and emit the appropriate intrinsic - - // A VectorSplat should have happened - assert(T0->isVectorTy() && T1->isVectorTy() && - "Dot product of vector and scalar is not supported."); + assert(CGM.getContext().hasSameUnqualifiedType(E->getArg(0)->getType(), + E->getArg(1)->getType()) && + "Dot product operands must have the same type."); auto *VecTy0 = E->getArg(0)->getType()->castAs<VectorType>(); - [[maybe_unused]] auto *VecTy1 = - E->getArg(1)->getType()->castAs<VectorType>(); - - assert(VecTy0->getElementType() == VecTy1->getElementType() && - "Dot product of vectors need the same element types."); - - assert(VecTy0->getNumElements() == VecTy1->getNumElements() && - "Dot product requires vectors to be of the same size."); + assert(VecTy0 && "Dot product argument must be a vector."); return Builder.CreateIntrinsic( /*ReturnType=*/T0->getScalarType(), |