[PATCH] D98856: Always emit error for wrong interfaces to scalable vectors, unless cmdline flag is passed.

Sander de Smalen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 18 05:11:27 PDT 2021


sdesmalen created this revision.
Herald added subscribers: dexonsmith, hiraditya, kristof.beyls, mgorny.
sdesmalen requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98856

Files:
  clang/lib/Driver/ToolChains/Clang.cpp
  llvm/include/llvm/CodeGen/ValueTypes.h
  llvm/include/llvm/Support/TypeSize.h
  llvm/lib/Analysis/InstructionSimplify.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  llvm/lib/CodeGen/ValueTypes.cpp
  llvm/lib/Support/CMakeLists.txt
  llvm/lib/Support/TypeSize.cpp
  llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp
  llvm/unittests/CodeGen/SelectionDAGAddressAnalysisTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98856.331522.patch
Type: text/x-patch
Size: 10044 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210318/c942440b/attachment.bin>


More information about the cfe-commits mailing list