[llvm-branch-commits] [llvm] a01a450 - [NFC][test] Precommit test for pr188989 (#188667)

Cullen Rhodes via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Apr 20 08:48:06 PDT 2026


Author: wanglei
Date: 2026-04-20T15:47:57Z
New Revision: a01a45066dae761209bbc4d81e1c64c615581607

URL: https://github.com/llvm/llvm-project/commit/a01a45066dae761209bbc4d81e1c64c615581607
DIFF: https://github.com/llvm/llvm-project/commit/a01a45066dae761209bbc4d81e1c64c615581607.diff

LOG: [NFC][test] Precommit test for pr188989 (#188667)

Precommit test for #188989.

This test case covers a scenario in the vector combine
foldShuffleToIdentity function where incorrect folding was caused when
different shuffle sequences shared the same initial Use *. This issue
may be due to cost model differences and currently reproduces only on
LoongArch for this test case.

(cherry picked from commit 3e015b89e8bd9c71f6bb1cf38747d2862f5d5a3d)

Added: 
    llvm/test/Transforms/VectorCombine/LoongArch/lit.local.cfg
    llvm/test/Transforms/VectorCombine/LoongArch/shuffle-identity-miscompile.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/VectorCombine/LoongArch/lit.local.cfg b/llvm/test/Transforms/VectorCombine/LoongArch/lit.local.cfg
new file mode 100644
index 0000000000000..9570af17fe5f1
--- /dev/null
+++ b/llvm/test/Transforms/VectorCombine/LoongArch/lit.local.cfg
@@ -0,0 +1,4 @@
+config.suffixes = [".ll"]
+
+if not "LoongArch" in config.root.targets:
+    config.unsupported = True

diff  --git a/llvm/test/Transforms/VectorCombine/LoongArch/shuffle-identity-miscompile.ll b/llvm/test/Transforms/VectorCombine/LoongArch/shuffle-identity-miscompile.ll
new file mode 100644
index 0000000000000..7ff1fc484c4fd
--- /dev/null
+++ b/llvm/test/Transforms/VectorCombine/LoongArch/shuffle-identity-miscompile.ll
@@ -0,0 +1,22 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
+; RUN: opt < %s -S -p vector-combine -mtriple=loongarch64 -mattr=+lsx | FileCheck %s
+
+define i32 @shuffle_
diff erent_lanes(<2 x i64> %0) local_unnamed_addr {
+; CHECK-LABEL: define i32 @shuffle_
diff erent_lanes(
+; CHECK-SAME: <2 x i64> [[TMP0:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT:  [[ENTRY:.*:]]
+; CHECK-NEXT:    [[TMP1:%.*]] = trunc <2 x i64> [[TMP0]] to <2 x i16>
+; CHECK-NEXT:    [[TMP2:%.*]] = trunc <2 x i64> [[TMP0]] to <2 x i16>
+; CHECK-NEXT:    [[TMP3:%.*]] = bitcast <2 x i16> zeroinitializer to i32
+; CHECK-NEXT:    ret i32 [[TMP3]]
+;
+entry:
+  %shuffle = shufflevector <2 x i64> %0, <2 x i64> poison, <4 x i32> <i32 0, i32 0, i32 1, i32 1>
+  %conv = trunc <4 x i64> %shuffle to <4 x i16>
+  %vecinit4.i = shufflevector <4 x i16> %conv, <4 x i16> poison, <4 x i32> <i32 2, i32 poison, i32 2, i32 poison>
+  %sub.i = sub <4 x i16> %conv, %vecinit4.i
+  %shuffle.i = shufflevector <4 x i16> %sub.i, <4 x i16> poison, <2 x i32> <i32 0, i32 2>
+  %1 = bitcast <2 x i16> %shuffle.i to i32
+  ret i32 %1
+
+}


        


More information about the llvm-branch-commits mailing list