[all-commits] [llvm/llvm-project] 1b1b30: [clang][SVE] Don't warn on vector to sizeless buil...

Joe Ellis via All-commits all-commits at lists.llvm.org
Tue Feb 23 05:41:44 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1b1b30cf0f7d9619afb32e16f4a7c007da4ffccf
      https://github.com/llvm/llvm-project/commit/1b1b30cf0f7d9619afb32e16f4a7c007da4ffccf
  Author: Joe Ellis <joe.ellis at arm.com>
  Date:   2021-02-23 (Tue, 23 Feb 2021)

  Changed paths:
    M clang/lib/Sema/SemaChecking.cpp
    M clang/test/SemaCXX/attr-arm-sve-vector-bits.cpp

  Log Message:
  -----------
  [clang][SVE] Don't warn on vector to sizeless builtin implicit conversion

This commit prevents warnings from -Wconversion when a clang vector type
is implicitly converted to a sizeless builtin type -- for example, when
implicitly converting a fixed-predicate to a scalable predicate.

The code below:

     1    #include <arm_sve.h>
     2
     3    #define N __ARM_FEATURE_SVE_BITS
     4    #define FIXED_ATTR __attribute__((arm_sve_vector_bits (N)))
     5    typedef svbool_t fixed_svbool_t FIXED_ATTR;
     6
     7    inline fixed_svbool_t foo(fixed_svbool_t p) {
     8      return svnot_z(svptrue_b64(), p);
     9    }

would previously raise this warning:

    warning: implicit conversion turns vector to scalar: \
    'fixed_svbool_t' (vector of 8 'unsigned char' values) to 'svbool_t' \
    (aka '__SVBool_t') [-Wconversion]

Note that many cases of these implicit conversions were already
permitted because many functions inside arm_sve.h are spawned via
preprocessor macros, and the call to isInSystemMacro would cover us in
this case. This commit fixes the remaining cases.

Differential Revision: https://reviews.llvm.org/D97053




More information about the All-commits mailing list