[llvm] dec3839 - [SLP][NFC]Add a test with the missed vectorization opportunity for stores with same address

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 7 13:53:34 PST 2024


Author: Alexey Bataev
Date: 2024-11-07T13:53:23-08:00
New Revision: dec38399795a7f238508ee100e5b057165724a60

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

LOG: [SLP][NFC]Add a test with the missed vectorization opportunity for stores with same address

Added: 
    llvm/test/Transforms/SLPVectorizer/RISCV/repeated-address-store.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/SLPVectorizer/RISCV/repeated-address-store.ll b/llvm/test/Transforms/SLPVectorizer/RISCV/repeated-address-store.ll
new file mode 100644
index 00000000000000..f126192271cd95
--- /dev/null
+++ b/llvm/test/Transforms/SLPVectorizer/RISCV/repeated-address-store.ll
@@ -0,0 +1,31 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -S --passes=slp-vectorizer -mtriple=riscv64-unknown-linux -mattr=+v < %s | FileCheck %s
+
+define void @test(ptr %dest) {
+; CHECK-LABEL: define void @test(
+; CHECK-SAME: ptr [[DEST:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT:  [[ENTRY:.*:]]
+; CHECK-NEXT:    [[INC3:%.*]] = getelementptr inbounds i32, ptr [[DEST]], i64 3
+; CHECK-NEXT:    store i32 1, ptr [[INC3]], align 2
+; CHECK-NEXT:    store i32 1, ptr [[DEST]], align 4
+; CHECK-NEXT:    [[INC1:%.*]] = getelementptr inbounds i32, ptr [[DEST]], i64 1
+; CHECK-NEXT:    store i32 1, ptr [[INC1]], align 2
+; CHECK-NEXT:    [[INC2:%.*]] = getelementptr inbounds i32, ptr [[DEST]], i64 2
+; CHECK-NEXT:    store i32 1, ptr [[INC2]], align 2
+; CHECK-NEXT:    store i32 2, ptr [[DEST]], align 2
+; CHECK-NEXT:    store i32 1, ptr [[INC3]], align 2
+; CHECK-NEXT:    ret void
+;
+entry:
+  %inc3 = getelementptr inbounds i32, ptr %dest, i64 3
+  store i32 1, ptr %inc3, align 2
+
+  store i32 1, ptr %dest, align 4
+  %inc1 = getelementptr inbounds i32, ptr %dest, i64 1
+  store i32 1, ptr %inc1, align 2
+  %inc2 = getelementptr inbounds i32, ptr %dest, i64 2
+  store i32 1, ptr %inc2, align 2
+  store i32 2, ptr %dest, align 2
+  store i32 1, ptr %inc3, align 2
+  ret void
+}


        


More information about the llvm-commits mailing list