1; RUN: opt -analyze -scalar-evolution < %s | FileCheck %s 2 3; CHECK: Loop %bb1: backedge-taken count is ((2 * %a.promoted) /u 2) 4 5target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" 6target triple = "x86_64-apple-macosx10.10.0" 7 8@a = global i8 -127, align 1 9@b = common global i32 0, align 4 10 11declare void @use(i32) 12 13define i32 @main() { 14bb: 15 %a.promoted = load i8, i8* @a 16 br label %bb1 17 18bb1: ; preds = %bb1, %bb 19 %tmp = phi i8 [ %tmp2, %bb1 ], [ %a.promoted, %bb ] 20 %tmp2 = add i8 %tmp, -1 21 %tmp3 = sext i8 %tmp to i32 22 %tmp4 = xor i32 %tmp3, -1 23 %tmp5 = sext i8 %tmp2 to i32 24 %tmpf = sub nsw i32 %tmp4, %tmp5 25 %tmp6 = trunc i32 %tmpf to i8 26 %tmp7 = icmp eq i8 %tmp6, 0 27 br i1 %tmp7, label %bb8, label %bb1 28 29bb8: ; preds = %bb1 30 store i8 %tmp2, i8* @a 31 store i32 %tmp4, i32* @b 32 %tmp9 = sext i8 %tmp2 to i32 33 call void @use(i32 %tmp9) 34 ret i32 0 35} 36