Skip to content

Commit 7ff7ce3

Browse files
committed
Revert the non-interleaved auto-vectorized case + rename %indvars.iv
1 parent 0445940 commit 7ff7ce3

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4894,9 +4894,8 @@ void AArch64TTIImpl::getUnrollingPreferences(
48944894
// Disable partial & runtime unrolling on -Os.
48954895
UP.PartialOptSizeThreshold = 0;
48964896

4897-
// No need to unroll auto-vectorized loops that were interleaved
4898-
if (findStringMetadataForLoop(L, "llvm.loop.isvectorized") &&
4899-
findStringMetadataForLoop(L, "llvm.loop.interleave.count"))
4897+
// No need to unroll auto-vectorized loops
4898+
if (findStringMetadataForLoop(L, "llvm.loop.isvectorized"))
49004899
return;
49014900

49024901
// Scan the loop: don't unroll loops with calls as this could prevent

llvm/test/Transforms/LoopUnroll/AArch64/vector.ll

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ define void @reverse(ptr %dst, ptr %src, i64 %len) {
1616
; APPLE-NEXT: [[UNROLL_ITER:%.*]] = sub i64 [[LEN]], [[XTRAITER]]
1717
; APPLE-NEXT: br label %[[FOR_BODY:.*]]
1818
; APPLE: [[FOR_COND_CLEANUP_LOOPEXIT_UNR_LCSSA_LOOPEXIT:.*]]:
19-
; APPLE-NEXT: [[INDVARS_IV_UNR_PH:%.*]] = phi i64 [ [[INDVARS_IV_NEXT_7:%.*]], %[[FOR_BODY]] ]
19+
; APPLE-NEXT: [[IV_UNR_PH:%.*]] = phi i64 [ [[INDVARS_IV_NEXT_7:%.*]], %[[FOR_BODY]] ]
2020
; APPLE-NEXT: br label %[[FOR_COND_CLEANUP_LOOPEXIT_UNR_LCSSA]]
2121
; APPLE: [[FOR_COND_CLEANUP_LOOPEXIT_UNR_LCSSA]]:
22-
; APPLE-NEXT: [[INDVARS_IV_UNR:%.*]] = phi i64 [ 0, %[[FOR_BODY_PREHEADER]] ], [ [[INDVARS_IV_UNR_PH]], %[[FOR_COND_CLEANUP_LOOPEXIT_UNR_LCSSA_LOOPEXIT]] ]
22+
; APPLE-NEXT: [[IV_UNR:%.*]] = phi i64 [ 0, %[[FOR_BODY_PREHEADER]] ], [ [[IV_UNR_PH]], %[[FOR_COND_CLEANUP_LOOPEXIT_UNR_LCSSA_LOOPEXIT]] ]
2323
; APPLE-NEXT: [[LCMP_MOD:%.*]] = icmp ne i64 [[XTRAITER]], 0
2424
; APPLE-NEXT: br i1 [[LCMP_MOD]], label %[[FOR_BODY_EPIL_PREHEADER:.*]], label %[[FOR_COND_CLEANUP_LOOPEXIT:.*]]
2525
; APPLE: [[FOR_BODY_EPIL_PREHEADER]]:
2626
; APPLE-NEXT: br label %[[FOR_BODY_EPIL:.*]]
2727
; APPLE: [[FOR_BODY_EPIL]]:
28-
; APPLE-NEXT: [[INDVARS_IV_EPIL:%.*]] = phi i64 [ [[INDVARS_IV_UNR]], %[[FOR_BODY_EPIL_PREHEADER]] ], [ [[INDVARS_IV_NEXT_EPIL:%.*]], %[[FOR_BODY_EPIL]] ]
28+
; APPLE-NEXT: [[INDVARS_IV_EPIL:%.*]] = phi i64 [ [[IV_UNR]], %[[FOR_BODY_EPIL_PREHEADER]] ], [ [[INDVARS_IV_NEXT_EPIL:%.*]], %[[FOR_BODY_EPIL]] ]
2929
; APPLE-NEXT: [[EPIL_ITER:%.*]] = phi i64 [ 0, %[[FOR_BODY_EPIL_PREHEADER]] ], [ [[EPIL_ITER_NEXT:%.*]], %[[FOR_BODY_EPIL]] ]
3030
; APPLE-NEXT: [[TMP3:%.*]] = sub nsw i64 [[LEN]], [[INDVARS_IV_EPIL]]
3131
; APPLE-NEXT: [[ARRAYIDX_EPIL:%.*]] = getelementptr inbounds <4 x float>, ptr [[SRC]], i64 [[TMP3]]
@@ -131,14 +131,14 @@ for.cond.cleanup: ; preds = %for.body, %entry
131131
ret void
132132

133133
for.body: ; preds = %for.body.preheader, %for.body
134-
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
135-
%1 = sub nsw i64 %len, %indvars.iv
134+
%iv = phi i64 [ 0, %for.body.preheader ], [ %iv.next, %for.body ]
135+
%1 = sub nsw i64 %len, %iv
136136
%arrayidx = getelementptr inbounds <4 x float>, ptr %src, i64 %1
137137
%2 = load <4 x float>, ptr %arrayidx, align 16
138-
%arrayidx2 = getelementptr inbounds nuw <4 x float>, ptr %dst, i64 %indvars.iv
138+
%arrayidx2 = getelementptr inbounds nuw <4 x float>, ptr %dst, i64 %iv
139139
store <4 x float> %2, ptr %arrayidx2, align 16
140-
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
141-
%exitcond.not = icmp eq i64 %indvars.iv.next, %len
140+
%iv.next = add nuw nsw i64 %iv, 1
141+
%exitcond.not = icmp eq i64 %iv.next, %len
142142
br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
143143
}
144144

0 commit comments

Comments
 (0)