[PATCH] D78210: [LV] Mark first-order recurrences as allowed exit
Ayal Zaks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 18 14:01:39 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8e0c5f720058: [LV] Mark first-order recurrences as allowed exits (authored by Ayal).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78210/new/
https://reviews.llvm.org/D78210
Files:
llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
llvm/test/Transforms/LoopVectorize/optsize.ll
Index: llvm/test/Transforms/LoopVectorize/optsize.ll
===================================================================
--- llvm/test/Transforms/LoopVectorize/optsize.ll
+++ llvm/test/Transforms/LoopVectorize/optsize.ll
@@ -121,6 +121,39 @@
br i1 %cmp26, label %for.body29, label %for.cond.cleanup28
}
+; PR45526: don't vectorize with fold-tail if first-order-recurrence is live-out.
+;
+define i32 @pr45526() optsize {
+;
+; CHECK-LABEL: @pr45526
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br label %loop
+; CHECK-EMPTY:
+; CHECK-NEXT: loop:
+; CHECK-NEXT: %piv = phi i32 [ 0, %entry ], [ %pivPlus1, %loop ]
+; CHECK-NEXT: %for = phi i32 [ 5, %entry ], [ %pivPlus1, %loop ]
+; CHECK-NEXT: %pivPlus1 = add nuw nsw i32 %piv, 1
+; CHECK-NEXT: %cond = icmp ult i32 %piv, 510
+; CHECK-NEXT: br i1 %cond, label %loop, label %exit
+; CHECK-EMPTY:
+; CHECK-NEXT: exit:
+; CHECK-NEXT: %for.lcssa = phi i32 [ %for, %loop ]
+; CHECK-NEXT: ret i32 %for.lcssa
+;
+entry:
+ br label %loop
+
+loop:
+ %piv = phi i32 [ 0, %entry ], [ %pivPlus1, %loop ]
+ %for = phi i32 [ 5, %entry ], [ %pivPlus1, %loop ]
+ %pivPlus1 = add nuw nsw i32 %piv, 1
+ %cond = icmp ult i32 %piv, 510
+ br i1 %cond, label %loop, label %exit
+
+exit:
+ ret i32 %for
+}
+
!llvm.module.flags = !{!0}
!0 = !{i32 1, !"ProfileSummary", !1}
!1 = !{!2, !3, !4, !5, !6, !7, !8, !9}
Index: llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+++ llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
@@ -668,6 +668,7 @@
if (RecurrenceDescriptor::isFirstOrderRecurrence(Phi, TheLoop,
SinkAfter, DT)) {
+ AllowedExit.insert(Phi);
FirstOrderRecurrences.insert(Phi);
continue;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78210.258557.patch
Type: text/x-patch
Size: 1908 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200418/e080e0e6/attachment.bin>
More information about the llvm-commits
mailing list