aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/ModuleBuilder.cpp
diff options
context:
space:
mode:
authorDavid Green <david.green@arm.com>2025-06-21 12:29:29 +0100
committerGitHub <noreply@github.com>2025-06-21 12:29:29 +0100
commit77941eba7f01fc6576b3e060a3fb9cad1a64f9ea (patch)
treef89236ac3acee8f851d3ff458a06f11decaf3fe6 /clang/lib/CodeGen/ModuleBuilder.cpp
parentea321392ebc487c1000e43576f44af99edf28a5f (diff)
downloadllvm-77941eba7f01fc6576b3e060a3fb9cad1a64f9ea.zip
llvm-77941eba7f01fc6576b3e060a3fb9cad1a64f9ea.tar.gz
llvm-77941eba7f01fc6576b3e060a3fb9cad1a64f9ea.tar.bz2
[CostModel] Add a DstTy to getShuffleCost (#141634)
A shuffle will take two input vectors and a mask, to produce a new vector of size <MaskElts x SrcEltTy>. Historically it has been assumed that the SrcTy and the DstTy are the same for getShuffleCost, with that being relaxed in recent years. If the Tp passed to getShuffleCost is the SrcTy, then the DstTy can be calculated from the Mask elts and the src elt size, but the Mask is not always provided and the Tp is not reliably always the SrcTy. This has led to situations notably in the SLP vectorizer but also in the generic cost routines where assumption about how vectors will be legalized are built into the generic cost routines - for example whether they will widen or promote, with the cost modelling assuming they will widen but the default lowering to promote for integer vectors. This patch attempts to start improving that - it originally tried to alter more of the cost model but that too quickly became too many changes at once, so this patch just plumbs in a DstTy to getShuffleCost so that DstTy and SrcTy can be reliably distinguished. The callers of getShuffleCost have been updated to try and include a DstTy that is more accurate. Otherwise it tries to be fairly non-functional, keeping the SrcTy used as the primary type used in shuffle cost routines, only using DstTy where it was in the past (for InsertSubVector for example). Some asserts have been added that help to check for consistent values when a Mask and a DstTy are provided to getShuffleCost. Some of them took a while to get right, and some non-mask calls might still be incorrect. Hopefully this will provide a useful base to build more shuffles that alter size.
Diffstat (limited to 'clang/lib/CodeGen/ModuleBuilder.cpp')
0 files changed, 0 insertions, 0 deletions