[llvm] [LV][NFC] Tidy up check-prof-info.ll test (PR #143884)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 12 07:33:25 PDT 2025
https://github.com/david-arm updated https://github.com/llvm/llvm-project/pull/143884
>From 479784b85fccc67a153a9d86eadd5956e3259556 Mon Sep 17 00:00:00 2001
From: David Sherwood <david.sherwood at arm.com>
Date: Thu, 12 Jun 2025 12:31:59 +0000
Subject: [PATCH 1/2] [LV][NFC] Tidy up check-prof-info.ll test
---
.../LoopVectorize/check-prof-info.ll | 134 +++++++++++-------
1 file changed, 79 insertions(+), 55 deletions(-)
diff --git a/llvm/test/Transforms/LoopVectorize/check-prof-info.ll b/llvm/test/Transforms/LoopVectorize/check-prof-info.ll
index 17013c5908065..7c9f21c2f47bd 100644
--- a/llvm/test/Transforms/LoopVectorize/check-prof-info.ll
+++ b/llvm/test/Transforms/LoopVectorize/check-prof-info.ll
@@ -1,24 +1,44 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --filter "br" --filter "^.*:"
; RUN: opt -passes="print<block-freq>,loop-vectorize" -force-vector-width=4 -force-vector-interleave=1 -S < %s | FileCheck %s
; RUN: opt -passes="print<block-freq>,loop-vectorize" -force-vector-width=4 -force-vector-interleave=4 -S < %s | FileCheck %s -check-prefix=CHECK-MASKED
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
- at a = dso_local global [1024 x i32] zeroinitializer, align 16
- at b = dso_local global [1024 x i32] zeroinitializer, align 16
+ at a = global [1024 x i32] zeroinitializer, align 16
+ at b = global [1024 x i32] zeroinitializer, align 16
; Check correctness of profile info for vectorization without epilog.
; Function Attrs: nofree norecurse nounwind uwtable
-define dso_local void @_Z3foov() local_unnamed_addr #0 {
+define void @_Z3foov() {
; CHECK-LABEL: @_Z3foov(
-; CHECK: [[VECTOR_BODY:vector\.body]]:
-; CHECK: br i1 [[TMP:%.*]], label [[MIDDLE_BLOCK:%.*]], label %[[VECTOR_BODY]], !prof [[LP1_255:\!.*]],
-; CHECK: [[FOR_BODY:for\.body]]:
-; CHECK: br i1 [[EXITCOND:%.*]], label [[FOR_END_LOOPEXIT:%.*]], label %[[FOR_BODY]], !prof [[LP0_0:\!.*]],
-; CHECK-MASKED: [[VECTOR_BODY:vector\.body]]:
-; CHECK-MASKED: br i1 [[TMP:%.*]], label [[MIDDLE_BLOCK:%.*]], label %[[VECTOR_BODY]], !prof [[LP1_63:\!.*]],
-; CHECK-MASKED: [[FOR_BODY:for\.body]]:
-; CHECK-MASKED: br i1 [[EXITCOND:%.*]], label [[FOR_END_LOOPEXIT:%.*]], label %[[FOR_BODY]], !prof [[LP0_0:\!.*]],
+; CHECK: entry:
+; CHECK: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]], !prof [[PROF0:![0-9]+]]
+; CHECK: vector.ph:
+; CHECK: br label [[VECTOR_BODY:%.*]]
+; CHECK: vector.body:
+; CHECK: br i1 [[TMP6:%.*]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !prof [[PROF1:![0-9]+]], !llvm.loop [[LOOP2:![0-9]+]]
+; CHECK: middle.block:
+; CHECK: br i1 true, label [[FOR_COND_CLEANUP:%.*]], label [[SCALAR_PH]], !prof [[PROF5:![0-9]+]]
+; CHECK: scalar.ph:
+; CHECK: br label [[FOR_BODY:%.*]]
+; CHECK: for.cond.cleanup:
+; CHECK: for.body:
+; CHECK: br i1 [[EXITCOND:%.*]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY]], !prof [[PROF6:![0-9]+]], !llvm.loop [[LOOP7:![0-9]+]]
+;
+; CHECK-MASKED-LABEL: @_Z3foov(
+; CHECK-MASKED: entry:
+; CHECK-MASKED: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]], !prof [[PROF0:![0-9]+]]
+; CHECK-MASKED: vector.ph:
+; CHECK-MASKED: br label [[VECTOR_BODY:%.*]]
+; CHECK-MASKED: vector.body:
+; CHECK-MASKED: br i1 [[TMP18:%.*]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !prof [[PROF1:![0-9]+]], !llvm.loop [[LOOP2:![0-9]+]]
+; CHECK-MASKED: middle.block:
+; CHECK-MASKED: br i1 true, label [[FOR_COND_CLEANUP:%.*]], label [[SCALAR_PH]], !prof [[PROF5:![0-9]+]]
+; CHECK-MASKED: scalar.ph:
+; CHECK-MASKED: br label [[FOR_BODY:%.*]]
+; CHECK-MASKED: for.cond.cleanup:
+; CHECK-MASKED: for.body:
+; CHECK-MASKED: br i1 [[EXITCOND:%.*]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY]], !prof [[PROF6:![0-9]+]], !llvm.loop [[LOOP7:![0-9]+]]
;
entry:
br label %for.body
@@ -27,32 +47,52 @@ for.cond.cleanup: ; preds = %for.body
ret void
for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %arrayidx = getelementptr inbounds [1024 x i32], ptr @b, i64 0, i64 %indvars.iv
- %0 = load i32, ptr %arrayidx, align 4, !tbaa !2
- %1 = trunc i64 %indvars.iv to i32
+ %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
+ %arrayidx = getelementptr inbounds [1024 x i32], ptr @b, i64 0, i64 %iv
+ %0 = load i32, ptr %arrayidx, align 4
+ %1 = trunc i64 %iv to i32
%mul = mul nsw i32 %0, %1
- %arrayidx2 = getelementptr inbounds [1024 x i32], ptr @a, i64 0, i64 %indvars.iv
- %2 = load i32, ptr %arrayidx2, align 4, !tbaa !2
+ %arrayidx2 = getelementptr inbounds [1024 x i32], ptr @a, i64 0, i64 %iv
+ %2 = load i32, ptr %arrayidx2, align 4
%add = add nsw i32 %2, %mul
- store i32 %add, ptr %arrayidx2, align 4, !tbaa !2
- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, 1024
+ store i32 %add, ptr %arrayidx2, align 4
+ %iv.next = add nuw nsw i64 %iv, 1
+ %exitcond = icmp eq i64 %iv.next, 1024
br i1 %exitcond, label %for.cond.cleanup, label %for.body, !prof !6
}
; Check correctness of profile info for vectorization with epilog.
; Function Attrs: nofree norecurse nounwind uwtable
-define dso_local void @_Z3foo2v() local_unnamed_addr #0 {
+define void @_Z3foo2v() {
; CHECK-LABEL: @_Z3foo2v(
-; CHECK: [[VECTOR_BODY:vector\.body]]:
-; CHECK: br i1 [[TMP:%.*]], label [[MIDDLE_BLOCK:%.*]], label %[[VECTOR_BODY]], !prof [[LP1_255:\!.*]],
-; CHECK: [[FOR_BODY:for\.body]]:
-; CHECK: br i1 [[EXITCOND:%.*]], label [[FOR_END_LOOPEXIT:%.*]], label %[[FOR_BODY]], !prof [[LP1_2:\!.*]],
-; CHECK-MASKED: [[VECTOR_BODY:vector\.body]]:
-; CHECK-MASKED: br i1 [[TMP:%.*]], label [[MIDDLE_BLOCK:%.*]], label %[[VECTOR_BODY]], !prof [[LP1_63:\!.*]],
-; CHECK-MASKED: [[FOR_BODY:for\.body]]:
-; CHECK-MASKED: br i1 [[EXITCOND:%.*]], label [[FOR_END_LOOPEXIT:%.*]], label %[[FOR_BODY]], !prof [[LP1_2:\!.*]],
+; CHECK: entry:
+; CHECK: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]], !prof [[PROF0]]
+; CHECK: vector.ph:
+; CHECK: br label [[VECTOR_BODY:%.*]]
+; CHECK: vector.body:
+; CHECK: br i1 [[TMP6:%.*]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !prof [[PROF1]], !llvm.loop [[LOOP8:![0-9]+]]
+; CHECK: middle.block:
+; CHECK: br i1 false, label [[FOR_COND_CLEANUP:%.*]], label [[SCALAR_PH]], !prof [[PROF5]]
+; CHECK: scalar.ph:
+; CHECK: br label [[FOR_BODY:%.*]]
+; CHECK: for.cond.cleanup:
+; CHECK: for.body:
+; CHECK: br i1 [[EXITCOND:%.*]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY]], !prof [[PROF9:![0-9]+]], !llvm.loop [[LOOP10:![0-9]+]]
+;
+; CHECK-MASKED-LABEL: @_Z3foo2v(
+; CHECK-MASKED: entry:
+; CHECK-MASKED: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]], !prof [[PROF0]]
+; CHECK-MASKED: vector.ph:
+; CHECK-MASKED: br label [[VECTOR_BODY:%.*]]
+; CHECK-MASKED: vector.body:
+; CHECK-MASKED: br i1 [[TMP18:%.*]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !prof [[PROF1]], !llvm.loop [[LOOP8:![0-9]+]]
+; CHECK-MASKED: middle.block:
+; CHECK-MASKED: br i1 false, label [[FOR_COND_CLEANUP:%.*]], label [[SCALAR_PH]], !prof [[PROF5]]
+; CHECK-MASKED: scalar.ph:
+; CHECK-MASKED: br label [[FOR_BODY:%.*]]
+; CHECK-MASKED: for.cond.cleanup:
+; CHECK-MASKED: for.body:
+; CHECK-MASKED: br i1 [[EXITCOND:%.*]], label [[FOR_COND_CLEANUP]], label [[FOR_BODY]], !prof [[PROF9:![0-9]+]], !llvm.loop [[LOOP10:![0-9]+]]
;
entry:
br label %for.body
@@ -61,36 +101,20 @@ for.cond.cleanup: ; preds = %for.body
ret void
for.body: ; preds = %for.body, %entry
- %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
- %arrayidx = getelementptr inbounds [1024 x i32], ptr @b, i64 0, i64 %indvars.iv
- %0 = load i32, ptr %arrayidx, align 4, !tbaa !2
- %1 = trunc i64 %indvars.iv to i32
+ %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
+ %arrayidx = getelementptr inbounds [1024 x i32], ptr @b, i64 0, i64 %iv
+ %0 = load i32, ptr %arrayidx, align 4
+ %1 = trunc i64 %iv to i32
%mul = mul nsw i32 %0, %1
- %arrayidx2 = getelementptr inbounds [1024 x i32], ptr @a, i64 0, i64 %indvars.iv
- %2 = load i32, ptr %arrayidx2, align 4, !tbaa !2
+ %arrayidx2 = getelementptr inbounds [1024 x i32], ptr @a, i64 0, i64 %iv
+ %2 = load i32, ptr %arrayidx2, align 4
%add = add nsw i32 %2, %mul
- store i32 %add, ptr %arrayidx2, align 4, !tbaa !2
- %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
- %exitcond = icmp eq i64 %indvars.iv.next, 1027
+ store i32 %add, ptr %arrayidx2, align 4
+ %iv.next = add nuw nsw i64 %iv, 1
+ %exitcond = icmp eq i64 %iv.next, 1027
br i1 %exitcond, label %for.cond.cleanup, label %for.body, !prof !7
}
-attributes #0 = { "use-soft-float"="false" }
-
-!llvm.module.flags = !{!0}
-!llvm.ident = !{!1}
-
-; CHECK: [[LP1_255]] = !{!"branch_weights", i32 1, i32 255}
-; CHECK: [[LP0_0]] = !{!"branch_weights", i32 0, i32 0}
-; CHECK-MASKED: [[LP1_63]] = !{!"branch_weights", i32 1, i32 63}
-; CHECK-MASKED: [[LP0_0]] = !{!"branch_weights", i32 0, i32 0}
-; CHECK: [[LP1_2]] = !{!"branch_weights", i32 1, i32 2}
-!0 = !{i32 1, !"wchar_size", i32 4}
-!1 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project c292b5b5e059e6ce3e6449e6827ef7e1037c21c4)"}
-!2 = !{!3, !3, i64 0}
-!3 = !{!"int", !4, i64 0}
-!4 = !{!"omnipotent char", !5, i64 0}
-!5 = !{!"Simple C++ TBAA"}
!6 = !{!"branch_weights", i32 1, i32 1023}
!7 = !{!"branch_weights", i32 1, i32 1026}
>From 171b599c12dda628b4706bc6a69c592c181e1357 Mon Sep 17 00:00:00 2001
From: David Sherwood <david.sherwood at arm.com>
Date: Thu, 12 Jun 2025 14:32:49 +0000
Subject: [PATCH 2/2] Address review comments
---
llvm/test/Transforms/LoopVectorize/check-prof-info.ll | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/llvm/test/Transforms/LoopVectorize/check-prof-info.ll b/llvm/test/Transforms/LoopVectorize/check-prof-info.ll
index 7c9f21c2f47bd..87c1ccb702277 100644
--- a/llvm/test/Transforms/LoopVectorize/check-prof-info.ll
+++ b/llvm/test/Transforms/LoopVectorize/check-prof-info.ll
@@ -8,7 +8,6 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
@b = global [1024 x i32] zeroinitializer, align 16
; Check correctness of profile info for vectorization without epilog.
-; Function Attrs: nofree norecurse nounwind uwtable
define void @_Z3foov() {
; CHECK-LABEL: @_Z3foov(
; CHECK: entry:
@@ -58,11 +57,10 @@ for.body: ; preds = %for.body, %entry
store i32 %add, ptr %arrayidx2, align 4
%iv.next = add nuw nsw i64 %iv, 1
%exitcond = icmp eq i64 %iv.next, 1024
- br i1 %exitcond, label %for.cond.cleanup, label %for.body, !prof !6
+ br i1 %exitcond, label %for.cond.cleanup, label %for.body, !prof !0
}
; Check correctness of profile info for vectorization with epilog.
-; Function Attrs: nofree norecurse nounwind uwtable
define void @_Z3foo2v() {
; CHECK-LABEL: @_Z3foo2v(
; CHECK: entry:
@@ -112,9 +110,9 @@ for.body: ; preds = %for.body, %entry
store i32 %add, ptr %arrayidx2, align 4
%iv.next = add nuw nsw i64 %iv, 1
%exitcond = icmp eq i64 %iv.next, 1027
- br i1 %exitcond, label %for.cond.cleanup, label %for.body, !prof !7
+ br i1 %exitcond, label %for.cond.cleanup, label %for.body, !prof !1
}
-!6 = !{!"branch_weights", i32 1, i32 1023}
-!7 = !{!"branch_weights", i32 1, i32 1026}
+!0 = !{!"branch_weights", i32 1, i32 1023}
+!1 = !{!"branch_weights", i32 1, i32 1026}
More information about the llvm-commits
mailing list