[all-commits] [llvm/llvm-project] 08d14e: [SLP] Fix CommonMask will be transformed into an i...

Han-Kuan Chen via All-commits all-commits at lists.llvm.org
Mon Jan 27 20:02:59 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 08d14e10ca4bdd4626cbe1c893961416f9703d5c
      https://github.com/llvm/llvm-project/commit/08d14e10ca4bdd4626cbe1c893961416f9703d5c
  Author: Han-Kuan Chen <hankuan.chen at sifive.com>
  Date:   2025-01-28 (Tue, 28 Jan 2025)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
    M llvm/test/Transforms/SLPVectorizer/RISCV/revec.ll
    M llvm/test/Transforms/SLPVectorizer/revec-shufflevector.ll

  Log Message:
  -----------
  [SLP] Fix CommonMask will be transformed into an incorrect mask if createShuffle is called multiple times. (#124244)

We have two types of mask in SLP: a scalar mask and a vector mask.
When vectorizing four i32 additions into <4 x i32>, SLP creates a mask
of length 4.
When vectorizing four <2 x i32> additions into <8 x i32>, SLP also
creates a mask of length 4.
We refer to the first case as a scalar mask (because the mask element
represents a scalar, i32), and the second case as a vector mask (because
the mask element represents a vector, <4 x i32>).
At some point, we must convert the scalar mask into a vector mask
(otherwise, calling TTI cost functions or IRBuilderBase functions may
yield incorrect results).
Since both ShuffleCostEstimator and ShuffleInstructionBuilder can modify
the CommonMask, we have decided to perform the mask transformation only
within createShuffle. However, we do not store the transformed result,
as createShuffle may be called multiple times.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list