[PATCH] D73286: [llvm][VectorUtils] Tweak VFShape for scalable vector functions.

Francesco Petrogalli via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 23 12:27:16 PST 2020


fpetrogalli created this revision.
fpetrogalli added reviewers: jdoerfert, sdesmalen.
Herald added subscribers: llvm-commits, hiraditya, kristof.beyls.
Herald added a project: LLVM.

This patche makes sure that the field VFShape.VF is greater than zero
when demangling the vector function name of scalable vector functions
encoded in the "vector-function-abi-variant" attribute.

This change is required to be able to provide instances of VFShape
that can be used to query the VFDatabase for the vectorization passes,
which always set a positive value for the Vectorization Factor (VF)
determined by the vectorization process.

It is not possible to extract the value of VFShape.VF from the mangled
name of scalable vector functions, because it is encoded as
`x`. Therefore, the VFABI demangling function has been modified to
extract such information from the IR declaration of the vector
function, under the assumption that _all_ vectors in the signature of
the vector function have the same number of lanes. Such assumption is
valid because it is also assumed by the Vector Function ABI
specifications supported by the demangling function (x86, AArch64, and
LLVM internal one).

The unit tests that demangle scalable names have been modified by
adding the IR module that carries the declaration of the vector
function name being demangled.

The code that has been added in the demangling function does not need
to be tested by the fuzzer as it does not use the input string of the
mangled name.

Assetions have been added to:

1. Make sure that a module M has been passed to the demangling

function when the mame of a scalable function is being de-mangled.

2. Make sure that the declaration of the scalable vector funcion is

present in the module.

3. Make sure that the value of VFSHape.VF is always greater than 0 for

both scalable names (for the reasons explained before) and for fixed
width names.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73286

Files:
  llvm/include/llvm/Analysis/VectorUtils.h
  llvm/lib/Analysis/VFABIDemangling.cpp
  llvm/lib/Analysis/VectorUtils.cpp
  llvm/lib/Transforms/Utils/ModuleUtils.cpp
  llvm/tools/vfabi-demangle-fuzzer/vfabi-demangler-fuzzer.cpp
  llvm/unittests/Analysis/VectorFunctionABITest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73286.239976.patch
Type: text/x-patch
Size: 10820 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200123/1e54bba2/attachment.bin>


More information about the llvm-commits mailing list