1; RUN: opt -mtriple=thumbv8.1m.main-arm-eabihf < %s -loop-vectorize -S | \ 2; RUN: FileCheck %s -check-prefixes=CHECK,NO-FOLDING 3 4; RUN: opt -mtriple=thumbv8.1m.main-arm-eabihf -mattr=-mve < %s -loop-vectorize -enable-arm-maskedldst=true -S | \ 5; RUN: FileCheck %s -check-prefixes=CHECK,NO-FOLDING 6 7; RUN: opt -mtriple=thumbv8.1m.main-arm-eabihf -mattr=+mve < %s -loop-vectorize -enable-arm-maskedldst=false -S | \ 8; RUN: FileCheck %s -check-prefixes=CHECK,NO-FOLDING 9 10; Disabling the low-overhead branch extension will make 11; 'isHardwareLoopProfitable' return false, so that we test avoiding folding for 12; these cases. 13; RUN: opt -mtriple=thumbv8.1m.main-arm-eabihf -mattr=+mve,-lob < %s -loop-vectorize -enable-arm-maskedldst=true -S | \ 14; RUN: FileCheck %s -check-prefixes=CHECK,NO-FOLDING 15 16; RUN: opt -mtriple=thumbv8.1m.main-arm-eabihf -mattr=+mve < %s -loop-vectorize -enable-arm-maskedldst=true -S | \ 17; RUN: FileCheck %s -check-prefixes=CHECK,PREFER-FOLDING 18 19define dso_local void @tail_folding(i32* noalias nocapture %A, i32* noalias nocapture readonly %B, i32* noalias nocapture readonly %C) { 20; CHECK-LABEL: tail_folding( 21; 22; NO-FOLDING-NOT: call <4 x i32> @llvm.masked.load.v4i32.p0v4i32( 23; NO-FOLDING-NOT: call void @llvm.masked.store.v4i32.p0v4i32( 24; 25; TODO: this needs implementation of TTI::preferPredicateOverEpilogue, 26; then this will be tail-folded too: 27; 28; PREFER-FOLDING-NOT: call <4 x i32> @llvm.masked.load.v4i32.p0v4i32( 29; PREFER-FOLDING-NOT: call void @llvm.masked.store.v4i32.p0v4i32( 30; 31entry: 32 br label %for.body 33 34for.cond.cleanup: 35 ret void 36 37for.body: 38 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ] 39 %arrayidx = getelementptr inbounds i32, i32* %B, i64 %indvars.iv 40 %0 = load i32, i32* %arrayidx, align 4 41 %arrayidx2 = getelementptr inbounds i32, i32* %C, i64 %indvars.iv 42 %1 = load i32, i32* %arrayidx2, align 4 43 %add = add nsw i32 %1, %0 44 %arrayidx4 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv 45 store i32 %add, i32* %arrayidx4, align 4 46 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 47 %exitcond = icmp eq i64 %indvars.iv.next, 430 48 br i1 %exitcond, label %for.cond.cleanup, label %for.body 49} 50