diff options
author | Farzon Lotfi <1802579+farzonl@users.noreply.github.com> | 2024-03-25 20:27:52 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-25 20:27:52 -0400 |
commit | 366592b4eb54d807ebecee122b7dd06031c5f4f9 (patch) | |
tree | f12b1e597e483bb8e82419b361327f76db1786fc /clang/lib/Sema/SemaChecking.cpp | |
parent | 350bda4419e15e5d68a87667988458546fa2e0c2 (diff) | |
download | llvm-366592b4eb54d807ebecee122b7dd06031c5f4f9.zip llvm-366592b4eb54d807ebecee122b7dd06031c5f4f9.tar.gz llvm-366592b4eb54d807ebecee122b7dd06031c5f4f9.tar.bz2 |
[HLSL] prevent generation of double intrinsics via the builtins (#86555)
fixes #86551
closes #86552
Thanks to #86440 and #86407 it makes more sense for us to do type checks
early via Sema to prevent the generation of invalid intrinsics.
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 246e357..c725ec0 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -5624,6 +5624,21 @@ bool Sema::CheckHLSLBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { TheCall, /*CheckForFloatArgs*/ TheCall->getArg(0)->getType()->hasFloatingRepresentation())) return true; + break; + } + // Note these are llvm builtins that we want to catch invalid intrinsic + // generation. Normal handling of these builitns will occur elsewhere. + case Builtin::BI__builtin_elementwise_cos: + case Builtin::BI__builtin_elementwise_sin: + case Builtin::BI__builtin_elementwise_log: + case Builtin::BI__builtin_elementwise_log2: + case Builtin::BI__builtin_elementwise_log10: + case Builtin::BI__builtin_elementwise_pow: + case Builtin::BI__builtin_elementwise_sqrt: + case Builtin::BI__builtin_elementwise_trunc: { + if (CheckFloatOrHalfRepresentations(this, TheCall)) + return true; + break; } } return false; |