1; RUN: llc -march=hexagon -mcpu=hexagonv5 -hexagon-hwloop-preheader < %s 2; REQUIRES: asserts 3 4; Test that the preheader is added to the parent loop, otherwise 5; we generate an invalid hardware loop. 6 7; Function Attrs: nounwind readonly 8define void @test(i16 signext %n) #0 { 9entry: 10 br i1 undef, label %for.cond4.preheader.preheader.split.us, label %for.end22 11 12for.cond4.preheader.preheader.split.us: 13 %0 = sext i16 %n to i32 14 br label %for.body9.preheader.us 15 16for.body9.us: 17 %indvars.iv = phi i32 [ %indvars.iv.next.7, %for.body9.us ], [ 0, %for.body9.preheader.us ] 18 %indvars.iv.next.7 = add i32 %indvars.iv, 8 19 %lftr.wideiv.7 = trunc i32 %indvars.iv.next.7 to i16 20 %exitcond.7 = icmp slt i16 %lftr.wideiv.7, 0 21 br i1 %exitcond.7, label %for.body9.us, label %for.body9.us.ur 22 23for.body9.preheader.us: 24 %i.030.us.pmt = phi i32 [ %inc21.us.pmt, %for.end.loopexit.us ], [ 0, %for.cond4.preheader.preheader.split.us ] 25 br i1 undef, label %for.body9.us, label %for.body9.us.ur 26 27for.body9.us.ur: 28 %exitcond.ur.old = icmp eq i16 undef, %n 29 br i1 %exitcond.ur.old, label %for.end.loopexit.us, label %for.body9.us.ur 30 31for.end.loopexit.us: 32 %inc21.us.pmt = add i32 %i.030.us.pmt, 1 33 %exitcond33 = icmp eq i32 %inc21.us.pmt, %0 34 br i1 %exitcond33, label %for.end22, label %for.body9.preheader.us 35 36for.end22: 37 ret void 38} 39 40attributes #0 = { nounwind readonly "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } 41