[llvm] [VPlan] Add a test for testing unused interleave recipes (PR #75026)
Shih-Po Hung via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 13 16:55:24 PST 2023
https://github.com/arcbbb updated https://github.com/llvm/llvm-project/pull/75026
>From bcd7002199b499dd6182193466a2d56d7f0d37f0 Mon Sep 17 00:00:00 2001
From: ShihPo Hung <shihpo.hung at sifive.com>
Date: Sun, 10 Dec 2023 18:42:38 -0800
Subject: [PATCH 1/3] [VPlan] Add a test for testing unused interleave recipes
- Precommit of tests from PR71360.
- Replace `undef` pointer operands and add stores to avoid the loads
being optmized away.
---
.../test/CodeGen/ARM/loopvectorize_pr33804.ll | 36 +++++++++------
.../AArch64/loopvectorize_pr33804_double.ll | 36 +++++++++------
.../LoopVectorize/unused-interleave-group.ll | 45 +++++++++++++++++++
3 files changed, 89 insertions(+), 28 deletions(-)
create mode 100644 llvm/test/Transforms/LoopVectorize/unused-interleave-group.ll
diff --git a/llvm/test/CodeGen/ARM/loopvectorize_pr33804.ll b/llvm/test/CodeGen/ARM/loopvectorize_pr33804.ll
index 540cbbfe96e812..8c8f91aaa4bb24 100644
--- a/llvm/test/CodeGen/ARM/loopvectorize_pr33804.ll
+++ b/llvm/test/CodeGen/ARM/loopvectorize_pr33804.ll
@@ -15,16 +15,16 @@ target triple = "armv7-unknown-linux-gnueabihf"
; CHECK-LABEL: @cvCalcEMD2
; CHECK: vector.body
; CHECK: store <{{[0-9]+}} x ptr>
-define void @cvCalcEMD2() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
+define void @cvCalcEMD2(ptr %dst) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
entry:
br label %for.body14.i.i
for.body14.i.i: ; preds = %for.body14.i.i, %entry
%i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ]
- %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D, ptr undef, i32 %i.1424.i.i
+ %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i
store float 0xC415AF1D80000000, ptr %arrayidx15.i.i1427, align 4
- %next19.i.i = getelementptr inbounds %struct.CvNode1D, ptr undef, i32 %i.1424.i.i, i32 1
- store ptr undef, ptr %next19.i.i, align 4
+ %next19.i.i = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i, i32 1
+ store ptr %dst, ptr %next19.i.i, align 4
%inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1
%exitcond438.i.i = icmp eq i32 %inc21.i.i, 0
br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i
@@ -40,15 +40,15 @@ for.end22.i.i: ; preds = %for.body14.i.i
; CHECK-LABEL: @cvCalcEMD2_2
; CHECK: vector.body
; CHECK: store <{{[0-9]+}} x float>
-define void @cvCalcEMD2_2() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
+define void @cvCalcEMD2_2(ptr %dst) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
entry:
br label %for.body14.i.i
for.body14.i.i: ; preds = %for.body14.i.i, %entry
%i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ]
- %next19.i.i = getelementptr inbounds %struct.CvNode1D2, ptr undef, i32 %i.1424.i.i, i32 0
- store ptr undef, ptr %next19.i.i, align 4
- %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D2, ptr undef, i32 %i.1424.i.i
+ %next19.i.i = getelementptr inbounds %struct.CvNode1D2, ptr %dst, i32 %i.1424.i.i, i32 0
+ store ptr %dst, ptr %next19.i.i, align 4
+ %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D2, ptr %dst, i32 %i.1424.i.i
%val.i.i = getelementptr inbounds %struct.CvNode1D2, ptr %arrayidx15.i.i1427, i32 0, i32 1
store float 0xC415AF1D80000000, ptr %val.i.i, align 4
%inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1
@@ -64,16 +64,20 @@ for.end22.i.i: ; preds = %for.body14.i.i
; CHECK-LABEL: @cvCalcEMD3
; CHECK: vector.body
; CHECK: inttoptr <{{[0-9]+}} x i32>
-define void @cvCalcEMD3() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
+define void @cvCalcEMD3(ptr %src, ptr %dst) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
entry:
br label %for.body14.i.i
for.body14.i.i: ; preds = %for.body14.i.i, %entry
%i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ]
- %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D, ptr undef, i32 %i.1424.i.i
+ %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D, ptr %src, i32 %i.1424.i.i
%loadf = load float, ptr %arrayidx15.i.i1427, align 4
- %next19.i.i = getelementptr inbounds %struct.CvNode1D, ptr undef, i32 %i.1424.i.i, i32 1
+ %next19.i.i = getelementptr inbounds %struct.CvNode1D, ptr %src, i32 %i.1424.i.i, i32 1
%loadp = load ptr, ptr %next19.i.i, align 4
+ %dst.ptr = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i
+ %dst.ptr.1 = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i, i32 1
+ store float %loadf, ptr %dst.ptr, align 4
+ store ptr %loadp, ptr %dst.ptr.1, align 4
%inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1
%exitcond438.i.i = icmp eq i32 %inc21.i.i, 0
br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i
@@ -87,17 +91,21 @@ for.end22.i.i: ; preds = %for.body14.i.i
; CHECK-LABEL: @cvCalcEMD3_2
; CHECK: vector.body
; CHECK: ptrtoint <{{[0-9]+}} x ptr>
-define void @cvCalcEMD3_2() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
+define void @cvCalcEMD3_2(ptr %src, ptr %dst) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
entry:
br label %for.body14.i.i
for.body14.i.i: ; preds = %for.body14.i.i, %entry
%i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ]
- %next19.i.i = getelementptr inbounds %struct.CvNode1D2, ptr undef, i32 %i.1424.i.i, i32 0
+ %next19.i.i = getelementptr inbounds %struct.CvNode1D2, ptr %src, i32 %i.1424.i.i, i32 0
%loadp = load ptr, ptr %next19.i.i, align 4
- %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D2, ptr undef, i32 %i.1424.i.i
+ %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D2, ptr %src, i32 %i.1424.i.i
%val.i.i = getelementptr inbounds %struct.CvNode1D2, ptr %arrayidx15.i.i1427, i32 0, i32 1
%loadf = load float, ptr %val.i.i, align 4
+ %dst.ptr = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i
+ %dst.ptr.1 = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i, i32 1
+ store float %loadf, ptr %dst.ptr, align 4
+ store ptr %loadp, ptr %dst.ptr.1, align 4
%inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1
%exitcond438.i.i = icmp eq i32 %inc21.i.i, 0
br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i
diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/loopvectorize_pr33804_double.ll b/llvm/test/Transforms/LoopVectorize/AArch64/loopvectorize_pr33804_double.ll
index 263da076fbb4e1..7680165ba4c17d 100644
--- a/llvm/test/Transforms/LoopVectorize/AArch64/loopvectorize_pr33804_double.ll
+++ b/llvm/test/Transforms/LoopVectorize/AArch64/loopvectorize_pr33804_double.ll
@@ -15,16 +15,16 @@ target triple = "aarch64-unknown-linux-gnu"
; CHECK-LABEL: @cvCalcEMD2
; CHECK: vector.body
; CHECK: store <{{[0-9]+}} x ptr>
-define void @cvCalcEMD2() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
+define void @cvCalcEMD2(ptr %dst) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
entry:
br label %for.body14.i.i
for.body14.i.i: ; preds = %for.body14.i.i, %entry
%i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ]
- %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D, ptr undef, i32 %i.1424.i.i
+ %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i
store double 0xC415AF1D80000000, ptr %arrayidx15.i.i1427, align 4
- %next19.i.i = getelementptr inbounds %struct.CvNode1D, ptr undef, i32 %i.1424.i.i, i32 1
- store ptr undef, ptr %next19.i.i, align 4
+ %next19.i.i = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i, i32 1
+ store ptr %dst, ptr %next19.i.i, align 4
%inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1
%exitcond438.i.i = icmp eq i32 %inc21.i.i, 0
br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i
@@ -40,15 +40,15 @@ for.end22.i.i: ; preds = %for.body14.i.i
; CHECK-LABEL: @cvCalcEMD2_2
; CHECK: vector.body
; CHECK: store <{{[0-9]+}} x double>
-define void @cvCalcEMD2_2() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
+define void @cvCalcEMD2_2(ptr %dst) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
entry:
br label %for.body14.i.i
for.body14.i.i: ; preds = %for.body14.i.i, %entry
%i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ]
- %next19.i.i = getelementptr inbounds %struct.CvNode1D2, ptr undef, i32 %i.1424.i.i, i32 0
- store ptr undef, ptr %next19.i.i, align 4
- %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D2, ptr undef, i32 %i.1424.i.i
+ %next19.i.i = getelementptr inbounds %struct.CvNode1D2, ptr %dst, i32 %i.1424.i.i, i32 0
+ store ptr %dst, ptr %next19.i.i, align 4
+ %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D2, ptr %dst, i32 %i.1424.i.i
%val.i.i = getelementptr inbounds %struct.CvNode1D2, ptr %arrayidx15.i.i1427, i32 0, i32 1
store double 0xC415AF1D80000000, ptr %val.i.i, align 4
%inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1
@@ -64,16 +64,20 @@ for.end22.i.i: ; preds = %for.body14.i.i
; CHECK-LABEL: @cvCalcEMD3
; CHECK: vector.body
; CHECK: inttoptr <{{[0-9]+}} x i64>
-define void @cvCalcEMD3() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
+define void @cvCalcEMD3(ptr %src, ptr %dst) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
entry:
br label %for.body14.i.i
for.body14.i.i: ; preds = %for.body14.i.i, %entry
%i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ]
- %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D, ptr undef, i32 %i.1424.i.i
+ %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D, ptr %src, i32 %i.1424.i.i
%load_d = load double, ptr %arrayidx15.i.i1427, align 4
- %next19.i.i = getelementptr inbounds %struct.CvNode1D, ptr undef, i32 %i.1424.i.i, i32 1
+ %next19.i.i = getelementptr inbounds %struct.CvNode1D, ptr %src, i32 %i.1424.i.i, i32 1
%load_p = load ptr, ptr %next19.i.i, align 4
+ %dst.ptr = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i
+ %dst.ptr.1 = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i, i32 1
+ store double %load_d, ptr %dst.ptr, align 4
+ store ptr %load_p, ptr %dst.ptr.1, align 4
%inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1
%exitcond438.i.i = icmp eq i32 %inc21.i.i, 0
br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i
@@ -87,17 +91,21 @@ for.end22.i.i: ; preds = %for.body14.i.i
; CHECK-LABEL: @cvCalcEMD3_2
; CHECK: vector.body
; CHECK: ptrtoint <{{[0-9]+}} x ptr>
-define void @cvCalcEMD3_2() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
+define void @cvCalcEMD3_2(ptr %src, ptr %dst) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
entry:
br label %for.body14.i.i
for.body14.i.i: ; preds = %for.body14.i.i, %entry
%i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ]
- %next19.i.i = getelementptr inbounds %struct.CvNode1D2, ptr undef, i32 %i.1424.i.i, i32 0
+ %next19.i.i = getelementptr inbounds %struct.CvNode1D2, ptr %src, i32 %i.1424.i.i, i32 0
%load_p = load ptr, ptr %next19.i.i, align 4
- %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D2, ptr undef, i32 %i.1424.i.i
+ %arrayidx15.i.i1427 = getelementptr inbounds %struct.CvNode1D2, ptr %src, i32 %i.1424.i.i
%val.i.i = getelementptr inbounds %struct.CvNode1D2, ptr %arrayidx15.i.i1427, i32 0, i32 1
%load_d = load double, ptr %val.i.i, align 4
+ %dst.ptr = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i
+ %dst.ptr.1 = getelementptr inbounds %struct.CvNode1D, ptr %dst, i32 %i.1424.i.i, i32 1
+ store double %load_d, ptr %dst.ptr, align 4
+ store ptr %load_p, ptr %dst.ptr.1, align 4
%inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1
%exitcond438.i.i = icmp eq i32 %inc21.i.i, 0
br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i
diff --git a/llvm/test/Transforms/LoopVectorize/unused-interleave-group.ll b/llvm/test/Transforms/LoopVectorize/unused-interleave-group.ll
new file mode 100644
index 00000000000000..85b0ecff4bd34f
--- /dev/null
+++ b/llvm/test/Transforms/LoopVectorize/unused-interleave-group.ll
@@ -0,0 +1,45 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
+; RUN: opt -passes=loop-vectorize -S -force-vector-width=4 -enable-interleaved-mem-accesses=true -debug-only=loop-vectorize < %s 2>&1 | FileCheck %s
+
+; This test checks if an unused interleave group is removed by removeDeadRecipes.
+
+%struct.foo = type { ptr, ptr }
+
+define void @test_unused_interleave(ptr %src) {
+; CHECK-LABEL: Checking a loop in 'test_unused_interleave'
+; CHECK: VPlan 'Initial VPlan for VF={4},UF>=1' {
+; CHECK-NEXT: Live-in vp<%0> = vector-trip-count
+; CHECK-NEXT: Live-in ir<0> = original trip-count
+; CHECK-EMPTY:
+; CHECK-NEXT: vector.ph:
+; CHECK-NEXT: Successor(s): vector loop
+; CHECK-EMPTY:
+; CHECK-NEXT: <x1> vector loop: {
+; CHECK-NEXT: vector.body:
+; CHECK-NEXT: EMIT vp<%1> = CANONICAL-INDUCTION ir<0>, vp<%6>
+; CHECK-NEXT: vp<%2> = SCALAR-STEPS vp<%1>, ir<1>
+; CHECK-NEXT: CLONE ir<%next19.i.i> = getelementptr inbounds ir<%src>, vp<%2>, ir<0>
+; CHECK-NEXT: INTERLEAVE-GROUP with factor 2 at %load_p1, ir<%next19.i.i>
+; CHECK-NEXT: ir<%load_p1> = load from index 0
+; CHECK-NEXT: ir<%load_p2> = load from index 1
+; CHECK-NEXT: EMIT vp<%6> = VF * UF + nuw vp<%1>
+; CHECK-NEXT: EMIT branch-on-count vp<%6>, vp<%0>
+; CHECK-NEXT: No successors
+; CHECK-NEXT: }
+entry:
+ br label %for.body14.i.i
+
+for.body14.i.i:
+ %i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ]
+ %next19.i.i = getelementptr inbounds %struct.foo, ptr %src, i32 %i.1424.i.i, i32 0
+ %load_p1 = load ptr, ptr %next19.i.i, align 4
+ %arrayidx15.i.i1427 = getelementptr inbounds %struct.foo, ptr %src, i32 %i.1424.i.i
+ %val.i.i = getelementptr inbounds %struct.foo, ptr %arrayidx15.i.i1427, i32 0, i32 1
+ %load_p2 = load ptr, ptr %val.i.i, align 4
+ %inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1
+ %exitcond438.i.i = icmp eq i32 %inc21.i.i, 0
+ br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i
+
+for.end22.i.i:
+ unreachable
+}
>From 6178134f8efe0ab8af22965940cba719ec46c923 Mon Sep 17 00:00:00 2001
From: ShihPo Hung <shihpo.hung at sifive.com>
Date: Mon, 11 Dec 2023 18:16:14 -0800
Subject: [PATCH 2/3] Remove unused attributes, and rename variables
---
.../test/CodeGen/ARM/loopvectorize_pr33804.ll | 13 ++++---------
.../AArch64/loopvectorize_pr33804_double.ll | 13 ++++---------
.../LoopVectorize/unused-interleave-group.ll | 19 ++++++++++---------
3 files changed, 18 insertions(+), 27 deletions(-)
diff --git a/llvm/test/CodeGen/ARM/loopvectorize_pr33804.ll b/llvm/test/CodeGen/ARM/loopvectorize_pr33804.ll
index 8c8f91aaa4bb24..8038dad3fe92f1 100644
--- a/llvm/test/CodeGen/ARM/loopvectorize_pr33804.ll
+++ b/llvm/test/CodeGen/ARM/loopvectorize_pr33804.ll
@@ -15,7 +15,7 @@ target triple = "armv7-unknown-linux-gnueabihf"
; CHECK-LABEL: @cvCalcEMD2
; CHECK: vector.body
; CHECK: store <{{[0-9]+}} x ptr>
-define void @cvCalcEMD2(ptr %dst) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
+define void @cvCalcEMD2(ptr %dst) {
entry:
br label %for.body14.i.i
@@ -40,7 +40,7 @@ for.end22.i.i: ; preds = %for.body14.i.i
; CHECK-LABEL: @cvCalcEMD2_2
; CHECK: vector.body
; CHECK: store <{{[0-9]+}} x float>
-define void @cvCalcEMD2_2(ptr %dst) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
+define void @cvCalcEMD2_2(ptr %dst) {
entry:
br label %for.body14.i.i
@@ -64,7 +64,7 @@ for.end22.i.i: ; preds = %for.body14.i.i
; CHECK-LABEL: @cvCalcEMD3
; CHECK: vector.body
; CHECK: inttoptr <{{[0-9]+}} x i32>
-define void @cvCalcEMD3(ptr %src, ptr %dst) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
+define void @cvCalcEMD3(ptr %src, ptr %dst) {
entry:
br label %for.body14.i.i
@@ -91,7 +91,7 @@ for.end22.i.i: ; preds = %for.body14.i.i
; CHECK-LABEL: @cvCalcEMD3_2
; CHECK: vector.body
; CHECK: ptrtoint <{{[0-9]+}} x ptr>
-define void @cvCalcEMD3_2(ptr %src, ptr %dst) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
+define void @cvCalcEMD3_2(ptr %src, ptr %dst) {
entry:
br label %for.body14.i.i
@@ -113,8 +113,3 @@ for.body14.i.i: ; preds = %for.body14.i.i, %en
for.end22.i.i: ; preds = %for.body14.i.i
unreachable
}
-
-declare i32 @__gxx_personality_v0(...)
-
-attributes #0 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+dsp,+neon,+vfp3,-thumb-mode" "unsafe-fp-math"="false" "use-soft-float"="false" }
-
diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/loopvectorize_pr33804_double.ll b/llvm/test/Transforms/LoopVectorize/AArch64/loopvectorize_pr33804_double.ll
index 7680165ba4c17d..0f3db228e9cfe3 100644
--- a/llvm/test/Transforms/LoopVectorize/AArch64/loopvectorize_pr33804_double.ll
+++ b/llvm/test/Transforms/LoopVectorize/AArch64/loopvectorize_pr33804_double.ll
@@ -15,7 +15,7 @@ target triple = "aarch64-unknown-linux-gnu"
; CHECK-LABEL: @cvCalcEMD2
; CHECK: vector.body
; CHECK: store <{{[0-9]+}} x ptr>
-define void @cvCalcEMD2(ptr %dst) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
+define void @cvCalcEMD2(ptr %dst) {
entry:
br label %for.body14.i.i
@@ -40,7 +40,7 @@ for.end22.i.i: ; preds = %for.body14.i.i
; CHECK-LABEL: @cvCalcEMD2_2
; CHECK: vector.body
; CHECK: store <{{[0-9]+}} x double>
-define void @cvCalcEMD2_2(ptr %dst) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
+define void @cvCalcEMD2_2(ptr %dst) {
entry:
br label %for.body14.i.i
@@ -64,7 +64,7 @@ for.end22.i.i: ; preds = %for.body14.i.i
; CHECK-LABEL: @cvCalcEMD3
; CHECK: vector.body
; CHECK: inttoptr <{{[0-9]+}} x i64>
-define void @cvCalcEMD3(ptr %src, ptr %dst) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
+define void @cvCalcEMD3(ptr %src, ptr %dst) {
entry:
br label %for.body14.i.i
@@ -91,7 +91,7 @@ for.end22.i.i: ; preds = %for.body14.i.i
; CHECK-LABEL: @cvCalcEMD3_2
; CHECK: vector.body
; CHECK: ptrtoint <{{[0-9]+}} x ptr>
-define void @cvCalcEMD3_2(ptr %src, ptr %dst) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
+define void @cvCalcEMD3_2(ptr %src, ptr %dst) {
entry:
br label %for.body14.i.i
@@ -113,8 +113,3 @@ for.body14.i.i: ; preds = %for.body14.i.i, %en
for.end22.i.i: ; preds = %for.body14.i.i
unreachable
}
-
-declare i32 @__gxx_personality_v0(...)
-
-attributes #0 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }
-
diff --git a/llvm/test/Transforms/LoopVectorize/unused-interleave-group.ll b/llvm/test/Transforms/LoopVectorize/unused-interleave-group.ll
index 85b0ecff4bd34f..e9f68f0dd1ccc5 100644
--- a/llvm/test/Transforms/LoopVectorize/unused-interleave-group.ll
+++ b/llvm/test/Transforms/LoopVectorize/unused-interleave-group.ll
@@ -1,15 +1,16 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
; RUN: opt -passes=loop-vectorize -S -force-vector-width=4 -enable-interleaved-mem-accesses=true -debug-only=loop-vectorize < %s 2>&1 | FileCheck %s
+; REQUIRES: asserts
; This test checks if an unused interleave group is removed by removeDeadRecipes.
%struct.foo = type { ptr, ptr }
-define void @test_unused_interleave(ptr %src) {
+define void @test_unused_interleave(ptr %src, i32 %length) {
; CHECK-LABEL: Checking a loop in 'test_unused_interleave'
; CHECK: VPlan 'Initial VPlan for VF={4},UF>=1' {
; CHECK-NEXT: Live-in vp<%0> = vector-trip-count
-; CHECK-NEXT: Live-in ir<0> = original trip-count
+; CHECK-NEXT: Live-in ir<%length> = original trip-count
; CHECK-EMPTY:
; CHECK-NEXT: vector.ph:
; CHECK-NEXT: Successor(s): vector loop
@@ -30,16 +31,16 @@ entry:
br label %for.body14.i.i
for.body14.i.i:
- %i.1424.i.i = phi i32 [ %inc21.i.i, %for.body14.i.i ], [ 0, %entry ]
- %next19.i.i = getelementptr inbounds %struct.foo, ptr %src, i32 %i.1424.i.i, i32 0
+ %iv = phi i32 [ %iv.next, %for.body14.i.i ], [ 0, %entry ]
+ %next19.i.i = getelementptr inbounds %struct.foo, ptr %src, i32 %iv, i32 0
%load_p1 = load ptr, ptr %next19.i.i, align 4
- %arrayidx15.i.i1427 = getelementptr inbounds %struct.foo, ptr %src, i32 %i.1424.i.i
+ %arrayidx15.i.i1427 = getelementptr inbounds %struct.foo, ptr %src, i32 %iv
%val.i.i = getelementptr inbounds %struct.foo, ptr %arrayidx15.i.i1427, i32 0, i32 1
%load_p2 = load ptr, ptr %val.i.i, align 4
- %inc21.i.i = add nuw nsw i32 %i.1424.i.i, 1
- %exitcond438.i.i = icmp eq i32 %inc21.i.i, 0
- br i1 %exitcond438.i.i, label %for.end22.i.i, label %for.body14.i.i
+ %iv.next = add nuw nsw i32 %iv, 1
+ %cond = icmp eq i32 %iv.next, %length
+ br i1 %cond, label %for.end22.i.i, label %for.body14.i.i
for.end22.i.i:
- unreachable
+ ret void
}
>From 41b2512c986e06caa7a52aefa8d7cccbb20e74f9 Mon Sep 17 00:00:00 2001
From: ShihPo Hung <shihpo.hung at sifive.com>
Date: Wed, 13 Dec 2023 16:51:21 -0800
Subject: [PATCH 3/3] Clean up the block names and add `vplan-` prefix to file
name.
---
...leave-group.ll => vplan-unused-interleave-group.ll} | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
rename llvm/test/Transforms/LoopVectorize/{unused-interleave-group.ll => vplan-unused-interleave-group.ll} (90%)
diff --git a/llvm/test/Transforms/LoopVectorize/unused-interleave-group.ll b/llvm/test/Transforms/LoopVectorize/vplan-unused-interleave-group.ll
similarity index 90%
rename from llvm/test/Transforms/LoopVectorize/unused-interleave-group.ll
rename to llvm/test/Transforms/LoopVectorize/vplan-unused-interleave-group.ll
index e9f68f0dd1ccc5..58ef924040d9a7 100644
--- a/llvm/test/Transforms/LoopVectorize/unused-interleave-group.ll
+++ b/llvm/test/Transforms/LoopVectorize/vplan-unused-interleave-group.ll
@@ -28,10 +28,10 @@ define void @test_unused_interleave(ptr %src, i32 %length) {
; CHECK-NEXT: No successors
; CHECK-NEXT: }
entry:
- br label %for.body14.i.i
+ br label %for.body
-for.body14.i.i:
- %iv = phi i32 [ %iv.next, %for.body14.i.i ], [ 0, %entry ]
+for.body:
+ %iv = phi i32 [ %iv.next, %for.body ], [ 0, %entry ]
%next19.i.i = getelementptr inbounds %struct.foo, ptr %src, i32 %iv, i32 0
%load_p1 = load ptr, ptr %next19.i.i, align 4
%arrayidx15.i.i1427 = getelementptr inbounds %struct.foo, ptr %src, i32 %iv
@@ -39,8 +39,8 @@ for.body14.i.i:
%load_p2 = load ptr, ptr %val.i.i, align 4
%iv.next = add nuw nsw i32 %iv, 1
%cond = icmp eq i32 %iv.next, %length
- br i1 %cond, label %for.end22.i.i, label %for.body14.i.i
+ br i1 %cond, label %for.end, label %for.body
-for.end22.i.i:
+for.end:
ret void
}
More information about the llvm-commits
mailing list