llvm-project/clang/lib
Sander de Smalen 0f7bbbc481 Always emit error for wrong interfaces to scalable vectors, unless cmdline flag is passed.
In order to bring up scalable vector support in LLVM incrementally,
we introduced behaviour to emit a warning, instead of an error, when
asking the wrong question of a scalable vector, like asking for the
fixed number of elements.

This patch puts that behaviour under a flag. The default behaviour is
that the compiler will always error, which means that all LLVM unit
tests and regression tests will now fail when a code-path is taken that
still uses the wrong interface.

The behaviour to demote an error to a warning can be individually enabled
for tools that want to support experimental use of scalable vectors.
This patch enables that behaviour when driving compilation from Clang.
This means that for users who want to try out scalable-vector support,
fixed-width codegen support, or build user-code with scalable vector
intrinsics, Clang will not crash and burn when the compiler encounters
such a case.

This allows us to do away with the following pattern in many of the SVE tests:
  RUN: .... 2>%t
  RUN: cat %t | FileCheck --check-prefix=WARN
  WARN-NOT: warning: ...

The behaviour to emit warnings is only temporary and we expect this flag
to be removed in the future when scalable vector support is more stable.

This patch also has fixes the following tests:
 unittests:
   ScalableVectorMVTsTest.SizeQueries
   SelectionDAGAddressAnalysisTest.unknownSizeFrameObjects
   AArch64SelectionDAGTest.computeKnownBitsSVE_ZERO_EXTEND_VECTOR_INREG

 regression tests:
   Transforms/InstCombine/vscale_gep.ll

Reviewed By: paulwalker-arm, ctetreau

Differential Revision: https://reviews.llvm.org/D98856
2021-04-02 10:55:22 +01:00
..
APINotes [clang][APINotes] Fix -Wunused-function warning (NFC) 2021-04-01 09:52:43 +08:00
ARCMigrate Make iteration over the DeclContext::lookup_result safe. 2021-03-17 08:59:04 +00:00
AST [clang][ItaniumMangle] Check SizeExpr for DependentSizedArrayType 2021-04-02 15:31:20 +08:00
ASTMatchers [ASTMatchers][NFC] Use SmallVector when building variadic matcher descriptor 2021-03-23 16:38:45 +00:00
Analysis Deduplicate branches and adjust comment [NFC] 2021-03-27 23:08:43 +01:00
Basic [OPENMP51]Initial support for the dispatch directive. 2021-03-30 14:12:53 -07:00
CodeGen [OpenMP] Pass mapping names to add components in a user defined mapper 2021-04-01 15:51:03 -04:00
CrossTU [analyzer][CTU] API for CTU macro expansions 2021-02-22 11:12:22 +01:00
DirectoryWatcher Revert "ADT: Migrate users of AlignedCharArrayUnion to std::aligned_union_t, NFC" 2020-12-14 17:04:06 -08:00
Driver Always emit error for wrong interfaces to scalable vectors, unless cmdline flag is passed. 2021-04-02 10:55:22 +01:00
Edit [clang] Use SourceLocation as key in hash maps, NFCI 2020-10-20 16:24:09 +01:00
Format [clang-format] Fix east const pointer alignment of operators 2021-03-30 17:18:32 +02:00
Frontend [C++2b] Support size_t literals 2021-03-31 13:36:23 +00:00
FrontendTool [NFC] Refactor Registry loops to range for 2020-06-19 00:40:10 +01:00
Headers [HIP] remove overloaded abs in header 2021-04-01 12:23:29 -04:00
Index [Clang][RISCV] Define RISC-V V builtin types 2021-02-18 10:17:31 +08:00
IndexSerialization [index-while-building] Fix build with -DBUILD_SHARED_LIBS=True 2020-08-20 15:12:56 +01:00
Lex [C++2b] Support size_t literals 2021-03-31 13:36:23 +00:00
Parse Revert "[clang][parser] Set source ranges for GNU-style attributes" 2021-04-01 17:32:40 +02:00
Rewrite [clang] DeltaTree::AddDelta - fix "initialization is never read" clang-tidy warning. NFCI. 2021-03-02 15:01:34 +00:00
Sema [clang-cl] [Sema] Do not prefer integral conversion over floating-to-integral for MS compatibility 19.28 and higher. 2021-04-02 08:58:22 +02:00
Serialization [OPENMP51]Initial support for the dispatch directive. 2021-03-30 14:12:53 -07:00
StaticAnalyzer [clang][Checkers] Extend PthreadLockChecker state dump (NFC). 2021-04-01 11:59:00 +02:00
Testing Fix MSVC "not all control paths return a value" warning. NFC. 2020-06-05 10:45:59 +01:00
Tooling [clang][Syntax] Optimize expandedTokens for token ranges. 2021-03-25 18:54:15 +01:00
CMakeLists.txt APINotes: add APINotesYAMLCompiler 2020-11-05 18:55:13 +00:00