[llvm] LV: add crash-test for incomplete cases in VPlan (PR #93551)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Tue May 28 07:07:57 PDT 2024


https://github.com/artagnon created https://github.com/llvm/llvm-project/pull/93551

The test is identical to the one in vplan-infer-not-or-type.ll, except that the trip count is now 3 instead of 2.

>From 9261244d283fc91ce509b81ccd9f85dde579d4aa Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <r at artagnon.com>
Date: Tue, 28 May 2024 13:47:16 +0100
Subject: [PATCH] [LV] add crash-test for incomplete cases in VPlan

The test is identical to the one in vplan-infer-not-or-type.ll, except
that the trip count is now 3 instead of 2.
---
 .../LoopVectorize/vplan-incomplete-cases.ll   | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 llvm/test/Transforms/LoopVectorize/vplan-incomplete-cases.ll

diff --git a/llvm/test/Transforms/LoopVectorize/vplan-incomplete-cases.ll b/llvm/test/Transforms/LoopVectorize/vplan-incomplete-cases.ll
new file mode 100644
index 0000000000000..2f3ed0d69d269
--- /dev/null
+++ b/llvm/test/Transforms/LoopVectorize/vplan-incomplete-cases.ll
@@ -0,0 +1,25 @@
+; REQUIRES: asserts
+; RUN: not --crash opt %s -passes=loop-vectorize -S
+
+define void @vplan_incomplete_cases_tc3(i8 %x, i8 %y) {
+entry:
+  br label %loop.header
+
+loop.header:                                        ; preds = %latch, %entry
+  %iv = phi i8 [ %iv.next, %latch ], [ 0, %entry ]
+  %and = and i8 %x, %y
+  %extract.t = trunc i8 %and to i1
+  br i1 %extract.t, label %latch, label %indirect.latch
+
+indirect.latch:                                     ; preds = %loop.header
+  br label %latch
+
+latch:                                              ; preds = %indirect.latch, loop.header
+  %iv.next = add i8 %iv, 1
+  %zext = zext i8 %iv to i32
+  %cmp = icmp ult i32 %zext, 2
+  br i1 %cmp, label %loop.header, label %exit
+
+exit:                                               ; preds = %latch
+  ret void
+}



More information about the llvm-commits mailing list