45 lines · plain
1; RUN: opt -disable-output "-passes=print<scalar-evolution>" < %s 2>&1 | FileCheck %s2 3; The initial SCEV for the backedge count is4; (zext i2 {(trunc i32 (1 + %a1) to i2),+,1}<%b2> to i32).5; In howFarToZero, this was further converted to an add-rec, the complexity6; of which defeated the calculation of the backedge taken count.7; Since such zero-extensions preserve the values being extended, strip8; them in howFarToZero to simplify the input SCEV.9 10; Check that the backedge taken count was actually computed:11; CHECK: Determining loop execution counts for: @f012; CHECK-NEXT: Loop %b2: backedge-taken count is (-1 + (-1 * (trunc i32 %a1 to i2)))13 14target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64"15 16define i32 @f0(i32 %a0, i32 %a1, ptr nocapture %a2) #0 {17b0:18 %v0 = and i32 %a1, 319 %v1 = icmp eq i32 %v0, 020 br i1 %v1, label %b4, label %b121 22b1: ; preds = %b023 %v2 = shl i32 %a0, 724 %v3 = add i32 %v2, -12825 br label %b226 27b2: ; preds = %b2, %b128 %v4 = phi i32 [ %a1, %b1 ], [ %v9, %b2 ]29 %v5 = phi ptr [ %a2, %b1 ], [ %v8, %b2 ]30 store i32 %v3, ptr %v5, align 431 %v8 = getelementptr inbounds i32, ptr %v5, i32 132 %v9 = add nsw i32 %v4, 133 %v10 = and i32 %v9, 334 %v11 = icmp eq i32 %v10, 035 br i1 %v11, label %b3, label %b236 37b3: ; preds = %b238 br label %b439 40b4: ; preds = %b3, %b041 ret i32 042}43 44attributes #0 = { norecurse nounwind }45