[llvm] [DAGCombiner] Require same type of splat & element for build_vector (PR #88284)

Shengchen Kan via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 10 19:52:49 PDT 2024


================
@@ -0,0 +1,24 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
+; RUN: llc < %s -mtriple=x86_64 -mattr=avx512bw | FileCheck %s
+
+; Verify that the DAGCombiner doesn't change build_vector to concat_vectors if
+; the vector element type is different than splat type. The example here:
+;   v8i1 = build_vector (i8 (bitcast (v8i1 X))), ..., (i8 (bitcast (v8i1 X))))
+
+define void @foo(<8 x i1> %mask.i1) {
----------------
KanRobert wrote:

Should we change the function prototype to `<8 x i1> @foo (<8 x i1> %mask.i1)` and return `%4` at line 23?

In the current variant, the function has no return value and has no side effects. I doubt it may be optimized to
```
define void @foo(<8 x i1> %mask.i1) {
entry:
return void
}
```

before ISEL in the future, then it checks nothing for DAG.

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


More information about the llvm-commits mailing list