[llvm-branch-commits] [llvm] afde142 - [LV] Add test for incorrect runtime check generation #57315.

Tobias Hieta via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Aug 29 23:09:56 PDT 2022


Author: Florian Hahn
Date: 2022-08-30T08:08:28+02:00
New Revision: afde142bfe28a89f8d1168c76512934ebd2b096d

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

LOG: [LV] Add test for incorrect runtime check generation #57315.

Test for PR57315 based on a test provided by @kpdev42.

(cherry picked from commit 6e56779e6bc168a3acd14f9bf2c4fd3fd9d86bd1)

Added: 
    

Modified: 
    llvm/test/Transforms/LoopVectorize/runtime-checks-difference.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/LoopVectorize/runtime-checks-
diff erence.ll b/llvm/test/Transforms/LoopVectorize/runtime-checks-
diff erence.ll
index e214f04674c4..c68584c074d2 100644
--- a/llvm/test/Transforms/LoopVectorize/runtime-checks-
diff erence.ll
+++ b/llvm/test/Transforms/LoopVectorize/runtime-checks-
diff erence.ll
@@ -171,3 +171,44 @@ loop:
 exit:
   ret void
 }
+
+; FIXME: Full no-overlap checks are required instead of 
diff erence checks, as
+; one of the add-recs used is invariant in the inner loop.
+; Test case for PR57315.
+define void @nested_loop_outer_iv_addrec_invariant_in_inner(ptr %a, ptr %b, i64 %n) {
+; CHECK-LABEL: @nested_loop_outer_iv_addrec_invariant_in_inner(
+; CHECK:       entry:
+; CHECK-NEXT:    [[B2:%.*]] = ptrtoint ptr [[B:%.*]] to i64
+; CHECK-NEXT:    [[A1:%.*]] = ptrtoint ptr [[A:%.*]] to i64
+; CHECK:       vector.memcheck:
+; CHECK-NEXT:    [[TMP1:%.*]] = sub i64 [[A1]], [[B2]]
+; CHECK-NEXT:    [[DIFF_CHECK:%.*]] = icmp ult i64 [[TMP1]], 16
+; CHECK-NEXT:    br i1 [[DIFF_CHECK]], label %scalar.ph, label %vector.ph
+;
+entry:
+  br label %outer.header
+
+outer.header:
+  %outer.iv = phi i64 [ %outer.iv.next, %outer.latch ], [ 0, %entry ]
+  %gep.a = getelementptr inbounds i32, ptr %a, i64 %outer.iv
+  br label %inner.body
+
+inner.body:
+  %red = phi i32 [ 0, %outer.header ], [ %red.next, %inner.body ]
+  %inner.iv = phi i64 [ 0, %outer.header ], [ %inner.iv.next, %inner.body ]
+  %gep.b = getelementptr inbounds i32, ptr %b, i64 %inner.iv
+  %l = load i32, ptr %gep.b, align 4
+  %red.next = sub i32 %red, %l
+  store i32 %red.next, ptr %gep.a, align 4
+  %inner.iv.next = add nuw nsw i64 %inner.iv, 1
+  %inner.cond = icmp eq i64 %inner.iv.next, %n
+  br i1 %inner.cond, label %outer.latch, label %inner.body
+
+outer.latch:
+  %outer.iv.next = add nuw nsw i64 %outer.iv, 1
+  %outer.cond = icmp eq i64 %outer.iv.next, %n
+  br i1 %outer.cond, label %exit, label %outer.header
+
+exit:
+  ret void
+}


        


More information about the llvm-branch-commits mailing list