[PATCH] D97053: [clang][SVE] Don't warn on vector to sizeless builtin implicit conversion
Joe Ellis via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 22 03:26:11 PST 2021
joechrisellis updated this revision to Diff 325410.
joechrisellis added a comment.
Address comments.
- @c-rhodes: remove test; it is probably not necessary.
- @craig.topper: add better constraints for when we do/don't bail out.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97053/new/
https://reviews.llvm.org/D97053
Files:
clang/lib/Sema/SemaChecking.cpp
clang/test/SemaCXX/attr-arm-sve-vector-bits.cpp
Index: clang/test/SemaCXX/attr-arm-sve-vector-bits.cpp
===================================================================
--- clang/test/SemaCXX/attr-arm-sve-vector-bits.cpp
+++ clang/test/SemaCXX/attr-arm-sve-vector-bits.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +bf16 -ffreestanding -fsyntax-only -verify -std=c++11 -msve-vector-bits=512 -fallow-half-arguments-and-returns %s
+// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +bf16 -ffreestanding -fsyntax-only -verify -std=c++11 -msve-vector-bits=512 -fallow-half-arguments-and-returns -Wconversion %s
// expected-no-diagnostics
#include <stdint.h>
Index: clang/lib/Sema/SemaChecking.cpp
===================================================================
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -12051,7 +12051,16 @@
checkObjCDictionaryLiteral(S, QualType(Target, 0), DictionaryLiteral);
// Strip vector types.
- if (isa<VectorType>(Source)) {
+ if (auto *SourceVT = dyn_cast<VectorType>(Source)) {
+ if (Target->isSizelessBuiltinType()) {
+ auto SourceVectorKind = SourceVT->getVectorKind();
+ if (SourceVectorKind == VectorType::SveFixedLengthDataVector ||
+ SourceVectorKind == VectorType::SveFixedLengthPredicateVector ||
+ (SourceVectorKind == VectorType::GenericVector &&
+ S.Context.getTypeSize(Source) == S.getLangOpts().ArmSveVectorBits))
+ return;
+ }
+
if (!isa<VectorType>(Target)) {
if (S.SourceMgr.isInSystemMacro(CC))
return;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97053.325410.patch
Type: text/x-patch
Size: 1623 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210222/7b547146/attachment-0001.bin>
More information about the cfe-commits
mailing list