[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 08:57:28 PST 2021


joechrisellis updated this revision to Diff 325461.
joechrisellis marked an inline comment as done.
joechrisellis added a comment.

Address @c-rhodes's comment.

- use `isVLSTBuiltinType` instead of `isSizelessBuiltinType`.


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->isVLSTBuiltinType()) {
+      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.325461.patch
Type: text/x-patch
Size: 1619 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210222/d6a0fdda/attachment-0001.bin>


More information about the cfe-commits mailing list