@@ -444,8 +444,6 @@ for.end: ; preds = %for.body, %entry
444444
445445; The next two cases check to see if we can infer the flags on the IV
446446; of a countdown loop using vscale strides.
447- ; TODO: We should be able to because vscale is a power of two and these
448- ; are finite loops by assumption.
449447
450448define void @vscale_countdown_ne (ptr nocapture %A , i32 %n ) mustprogress vscale_range(2 ,1024 ) {
451449; CHECK-LABEL: 'vscale_countdown_ne'
@@ -455,15 +453,16 @@ define void @vscale_countdown_ne(ptr nocapture %A, i32 %n) mustprogress vscale_r
455453; CHECK-NEXT: %start = sub i32 %n, %vscale
456454; CHECK-NEXT: --> ((-1 * vscale)<nsw> + %n) U: full-set S: full-set
457455; CHECK-NEXT: %iv = phi i32 [ %sub, %for.body ], [ %start, %entry ]
458- ; CHECK-NEXT: --> {((-1 * vscale)<nsw> + %n),+,(-1 * vscale)<nsw>}<%for.body> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %for.body: Computable }
456+ ; CHECK-NEXT: --> {((-1 * vscale)<nsw> + %n),+,(-1 * vscale)<nsw>}<%for.body> U: full-set S: full-set Exits: ((vscale * (-1 + (-1 * (((-2 * vscale)<nsw> + %n) /u vscale))<nsw>)<nsw>) + %n) LoopDispositions: { %for.body: Computable }
459457; CHECK-NEXT: %arrayidx = getelementptr inbounds i32, ptr %A, i32 %iv
460- ; CHECK-NEXT: --> {((4 * %n) + (-4 * vscale)<nsw> + %A),+,(-4 * vscale)<nsw>}<%for.body> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %for.body: Computable }
458+ ; CHECK-NEXT: --> {((4 * %n) + (-4 * vscale)<nsw> + %A),+,(-4 * vscale)<nsw>}<%for.body> U: full-set S: full-set Exits: ((4 * %n) + (vscale * (-4 + (-4 * (((-2 * vscale)<nsw> + %n) /u vscale)))) + %A) LoopDispositions: { %for.body: Computable }
461459; CHECK-NEXT: %sub = sub i32 %iv, %vscale
462- ; CHECK-NEXT: --> {((-2 * vscale)<nsw> + %n),+,(-1 * vscale)<nsw>}<%for.body> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %for.body: Computable }
460+ ; CHECK-NEXT: --> {((-2 * vscale)<nsw> + %n),+,(-1 * vscale)<nsw>}<nw>< %for.body> U: full-set S: full-set Exits: ((vscale * (-2 + (-1 * (((-2 * vscale)<nsw> + %n) /u vscale))<nsw>)) + %n) LoopDispositions: { %for.body: Computable }
463461; CHECK-NEXT: Determining loop execution counts for: @vscale_countdown_ne
464- ; CHECK-NEXT: Loop %for.body: Unpredictable backedge-taken count.
465- ; CHECK-NEXT: Loop %for.body: Unpredictable constant max backedge-taken count.
466- ; CHECK-NEXT: Loop %for.body: Unpredictable symbolic max backedge-taken count.
462+ ; CHECK-NEXT: Loop %for.body: backedge-taken count is (((-2 * vscale)<nsw> + %n) /u vscale)
463+ ; CHECK-NEXT: Loop %for.body: constant max backedge-taken count is i32 2147483647
464+ ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (((-2 * vscale)<nsw> + %n) /u vscale)
465+ ; CHECK-NEXT: Loop %for.body: Trip multiple is 1
467466;
468467entry:
469468 %vscale = call i32 @llvm.vscale.i32 ()
@@ -495,15 +494,16 @@ define void @vscalex4_countdown_ne(ptr nocapture %A, i32 %n) mustprogress vscale
495494; CHECK-NEXT: %start = sub i32 %n, %VF
496495; CHECK-NEXT: --> ((-4 * vscale)<nsw> + %n) U: full-set S: full-set
497496; CHECK-NEXT: %iv = phi i32 [ %sub, %for.body ], [ %start, %entry ]
498- ; CHECK-NEXT: --> {((-4 * vscale)<nsw> + %n),+,(-4 * vscale)<nsw>}<%for.body> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %for.body: Computable }
497+ ; CHECK-NEXT: --> {((-4 * vscale)<nsw> + %n),+,(-4 * vscale)<nsw>}<%for.body> U: full-set S: full-set Exits: ((vscale * (-4 + (-4 * (((-8 * vscale)<nsw> + %n) /u (4 * vscale)<nuw><nsw>))<nsw>)<nsw>) + %n) LoopDispositions: { %for.body: Computable }
499498; CHECK-NEXT: %arrayidx = getelementptr inbounds i32, ptr %A, i32 %iv
500- ; CHECK-NEXT: --> {((4 * %n) + (-16 * vscale)<nsw> + %A),+,(-16 * vscale)<nsw>}<%for.body> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %for.body: Computable }
499+ ; CHECK-NEXT: --> {((4 * %n) + (-16 * vscale)<nsw> + %A),+,(-16 * vscale)<nsw>}<%for.body> U: full-set S: full-set Exits: ((4 * %n) + (vscale * (-16 + (-16 * (((-8 * vscale)<nsw> + %n) /u (4 * vscale)<nuw><nsw>)))) + %A) LoopDispositions: { %for.body: Computable }
501500; CHECK-NEXT: %sub = sub i32 %iv, %VF
502- ; CHECK-NEXT: --> {((-8 * vscale)<nsw> + %n),+,(-4 * vscale)<nsw>}<%for.body> U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %for.body: Computable }
501+ ; CHECK-NEXT: --> {((-8 * vscale)<nsw> + %n),+,(-4 * vscale)<nsw>}<nw>< %for.body> U: full-set S: full-set Exits: ((vscale * (-8 + (-4 * (((-8 * vscale)<nsw> + %n) /u (4 * vscale)<nuw><nsw>))<nsw>)) + %n) LoopDispositions: { %for.body: Computable }
503502; CHECK-NEXT: Determining loop execution counts for: @vscalex4_countdown_ne
504- ; CHECK-NEXT: Loop %for.body: Unpredictable backedge-taken count.
505- ; CHECK-NEXT: Loop %for.body: Unpredictable constant max backedge-taken count.
506- ; CHECK-NEXT: Loop %for.body: Unpredictable symbolic max backedge-taken count.
503+ ; CHECK-NEXT: Loop %for.body: backedge-taken count is (((-8 * vscale)<nsw> + %n) /u (4 * vscale)<nuw><nsw>)
504+ ; CHECK-NEXT: Loop %for.body: constant max backedge-taken count is i32 536870911
505+ ; CHECK-NEXT: Loop %for.body: symbolic max backedge-taken count is (((-8 * vscale)<nsw> + %n) /u (4 * vscale)<nuw><nsw>)
506+ ; CHECK-NEXT: Loop %for.body: Trip multiple is 1
507507;
508508entry:
509509 %vscale = call i32 @llvm.vscale.i32 ()
0 commit comments