[llvm] [SLP] The order of store chains needs to consider the size of the values. (PR #101810)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 5 05:28:27 PDT 2024
tcwzxx wrote:
> I don't see test update
The existing test cases are fine.
There is a new pattern :
```
; RUN: opt -S --passes=slp-vectorizer -mtriple=x86_64-unknown-linux < %s | FileCheck %s
define void @test(ptr %p) {
entry:
%idx1 = getelementptr i8, ptr %p, i64 1
store i8 0, ptr %idx1, align 4
%idx.64.9 = getelementptr i64, ptr %p, i64 9
store i64 1, ptr %idx.64.9, align 8
%idx2 = getelementptr i8, ptr %p, i64 2
store i8 0, ptr %idx2, align 4
%idx3 = getelementptr i8, ptr %p, i64 3
store i8 0, ptr %idx3, align 4
%idx4 = getelementptr i8, ptr %p, i64 4
store i8 0, ptr %idx4, align 4
%idx5 = getelementptr i8, ptr %p, i64 5
store i8 0, ptr %idx5, align 4
%idx6 = getelementptr i8, ptr %p, i64 6
store i8 0, ptr %idx6, align 4
%idx7 = getelementptr i8, ptr %p, i64 7
store i8 0, ptr %idx7, align 4
%idx8 = getelementptr i8, ptr %p, i64 8
store i8 0, ptr %idx8, align 4
ret void
}
```
Before the patch:
```
define void @test(ptr %p) {
entry:
%idx1 = getelementptr i8, ptr %p, i64 1
store i8 0, ptr %idx1, align 4
%idx.64.9 = getelementptr i64, ptr %p, i64 9
store i64 1, ptr %idx.64.9, align 8
%idx2 = getelementptr i8, ptr %p, i64 2
store <4 x i8> zeroinitializer, ptr %idx2, align 4
%idx6 = getelementptr i8, ptr %p, i64 6
store i8 0, ptr %idx6, align 4
%idx7 = getelementptr i8, ptr %p, i64 7
store i8 0, ptr %idx7, align 4
%idx8 = getelementptr i8, ptr %p, i64 8
store i8 0, ptr %idx8, align 4
ret void
}
```
After the patch:
```
define void @test(ptr %p) {
entry:
%idx1 = getelementptr i8, ptr %p, i64 1
%idx.64.9 = getelementptr i64, ptr %p, i64 9
store i64 1, ptr %idx.64.9, align 8
store <8 x i8> zeroinitializer, ptr %idx1, align 4
ret void
}
```
> Add a test in a separate patch
I will commit the above test case in a different PR.
https://github.com/llvm/llvm-project/pull/101810
More information about the llvm-commits
mailing list