[llvm] DSE: pre-commit tests for scalable vectors (PR #110669)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 28 03:53:27 PST 2024


================
@@ -97,3 +189,30 @@ bb:
   ret void
 }
 
+define void @ScalableVectorTestPartiallyOverlapping(ptr %arg, i32 %i) {
+;
+; The DSE pass will not kill the store because the overlap is partial
+; and won't fully clobber the original store.
+;
+; CHECK-LABEL: @ScalableVectorTestPartiallyOverlapping(
+; CHECK-NEXT:  bb:
+; CHECK-NEXT:    [[I2:%.*]] = zext i32 [[I:%.*]] to i64
+; CHECK-NEXT:    [[I3:%.*]] = getelementptr inbounds float, ptr [[ARG:%.*]], i64 [[I2]]
+; CHECK-NEXT:    store <vscale x 2 x float> zeroinitializer, ptr [[I3]], align 8
+; CHECK-NEXT:    [[I5:%.*]] = add nuw nsw i32 [[I]], 1
+; CHECK-NEXT:    [[I6:%.*]] = zext i32 [[I5]] to i64
+; CHECK-NEXT:    [[I7:%.*]] = getelementptr inbounds float, ptr [[ARG]], i64 [[I6]]
+; CHECK-NEXT:    store <vscale x 2 x float> zeroinitializer, ptr [[I7]], align 8
+; CHECK-NEXT:    ret void
+;
+bb:
+  %i2 = zext i32 %i to i64
+  %i3 = getelementptr inbounds float, ptr %arg, i64 %i2
+  store <vscale x 2 x float> zeroinitializer, ptr %i3
+  %i5 = add nuw nsw i32 %i, 1
+  %i6 = zext i32 %i5 to i64
+  %i7 = getelementptr inbounds float, ptr %arg, i64 %i6
----------------
fhahn wrote:

```suggestion
  %gep.arg.i.1 = getelementptr inbounds float, ptr %arg, i64 %i6
```

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


More information about the llvm-commits mailing list