[llvm] [LoongArch] Always try to widen vectors at the beginning of lowerVECTOR_SHUFFLE_XVPERMI (PR #164219)

Zhaoxin Yang via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 20 20:35:09 PDT 2025


================
@@ -2103,6 +2103,12 @@ static SDValue
 lowerVECTOR_SHUFFLE_XVPERMI(const SDLoc &DL, ArrayRef<int> Mask, MVT VT,
                             SDValue V1, SelectionDAG &DAG,
                             const LoongArchSubtarget &Subtarget) {
+  // Before selecting XVPERMI_D, always try to widen vectors to gain more
+  // optimization opportunities.
+  if (SDValue NewShuffle = widenShuffleMask(
+          DL, Mask, VT, V1, DAG.getUNDEF(V1.getValueType()), DAG))
+    return NewShuffle;
----------------
ylzsx wrote:

Yeah, you are right. My comment was not precise enough and I will modify it. However I'm not sure if there could be scenarios where it worsens, although running the llvm-test-suite did not reveal any issues.

https://github.com/llvm/llvm-project/pull/164219


More information about the llvm-commits mailing list