1; RUN: opt -mtriple=thumbv8.1m.main-arm-eabihf -mattr=+mve.fp -loop-vectorize -tail-predication=enabled -S < %s | \
2; RUN:  FileCheck %s
3
4; Test that ARMTTIImpl::preferPredicateOverEpilogue triggers tail-folding.
5
6define dso_local void @f1(i32* noalias nocapture %A, i32* noalias nocapture readonly %B, i32* noalias nocapture readonly %C, i32 %N) {
7; CHECK-LABEL: f1(
8; CHECK:       entry:
9; CHECK:       @llvm.get.active.lane.mask
10; CHECK:       }
11entry:
12  %cmp8 = icmp sgt i32 %N, 0
13  br i1 %cmp8, label %for.body.preheader, label %for.cond.cleanup
14
15for.body.preheader:                               ; preds = %entry
16  br label %for.body
17
18for.cond.cleanup.loopexit:                        ; preds = %for.body
19  br label %for.cond.cleanup
20
21for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry
22  ret void
23
24for.body:                                         ; preds = %for.body.preheader, %for.body
25  %i.09 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
26  %arrayidx = getelementptr inbounds i32, i32* %B, i32 %i.09
27  %0 = load i32, i32* %arrayidx, align 4
28  %arrayidx1 = getelementptr inbounds i32, i32* %C, i32 %i.09
29  %1 = load i32, i32* %arrayidx1, align 4
30  %add = add nsw i32 %1, %0
31  %arrayidx2 = getelementptr inbounds i32, i32* %A, i32 %i.09
32  store i32 %add, i32* %arrayidx2, align 4
33  %inc = add nuw nsw i32 %i.09, 1
34  %exitcond.not = icmp eq i32 %inc, %N
35  br i1 %exitcond.not, label %for.cond.cleanup.loopexit, label %for.body
36}
37