133 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py2; RUN: opt < %s -disable-output "-passes=print<scalar-evolution>" 2>&1 | FileCheck %s3 4define void @foo(ptr nocapture %arg, i32 %arg1, i32 %arg2) {5; CHECK-LABEL: 'foo'6; CHECK-NEXT: Classifying expressions for: @foo7; CHECK-NEXT: %tmp4 = zext i32 %arg2 to i648; CHECK-NEXT: --> (zext i32 %arg2 to i64) U: [0,4294967296) S: [0,4294967296)9; CHECK-NEXT: %tmp8 = phi i64 [ %tmp18, %bb7 ], [ 0, %bb3 ]10; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%bb7> U: [0,2147483647) S: [0,2147483647) Exits: (-1 + (zext i32 %arg2 to i64))<nsw> LoopDispositions: { %bb7: Computable }11; CHECK-NEXT: %tmp9 = shl i64 %tmp8, 3312; CHECK-NEXT: --> {0,+,8589934592}<nuw><%bb7> U: [0,-17179869183) S: [-9223372036854775808,9223372028264841217) Exits: (-8589934592 + (8589934592 * (zext i32 %arg2 to i64))) LoopDispositions: { %bb7: Computable }13; CHECK-NEXT: %tmp10 = ashr exact i64 %tmp9, 3214; CHECK-NEXT: --> (sext i32 {0,+,2}<%bb7> to i64) U: [0,-1) S: [-2147483648,2147483647) Exits: (sext i32 (-2 + (2 * %arg2)) to i64) LoopDispositions: { %bb7: Computable }15; CHECK-NEXT: %tmp11 = getelementptr inbounds i32, ptr %arg, i64 %tmp1016; CHECK-NEXT: --> ((4 * (sext i32 {0,+,2}<%bb7> to i64))<nsw> + %arg) U: full-set S: full-set Exits: ((4 * (sext i32 (-2 + (2 * %arg2)) to i64))<nsw> + %arg) LoopDispositions: { %bb7: Computable }17; CHECK-NEXT: %tmp12 = load i32, ptr %tmp11, align 418; CHECK-NEXT: --> %tmp12 U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %bb7: Variant }19; CHECK-NEXT: %tmp13 = sub nsw i32 %tmp12, %arg120; CHECK-NEXT: --> ((-1 * %arg1) + %tmp12) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %bb7: Variant }21; CHECK-NEXT: %tmp14 = or disjoint i64 %tmp10, 122; CHECK-NEXT: --> (1 + (sext i32 {0,+,2}<%bb7> to i64))<nuw><nsw> U: [1,0) S: [-2147483647,2147483648) Exits: (1 + (sext i32 (-2 + (2 * %arg2)) to i64))<nuw><nsw> LoopDispositions: { %bb7: Computable }23; CHECK-NEXT: %tmp15 = getelementptr inbounds i32, ptr %arg, i64 %tmp1424; CHECK-NEXT: --> (4 + (4 * (sext i32 {0,+,2}<%bb7> to i64))<nsw> + %arg) U: full-set S: full-set Exits: (4 + (4 * (sext i32 (-2 + (2 * %arg2)) to i64))<nsw> + %arg) LoopDispositions: { %bb7: Computable }25; CHECK-NEXT: %tmp16 = load i32, ptr %tmp15, align 426; CHECK-NEXT: --> %tmp16 U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %bb7: Variant }27; CHECK-NEXT: %tmp17 = mul nsw i32 %tmp16, %arg128; CHECK-NEXT: --> (%arg1 * %tmp16) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %bb7: Variant }29; CHECK-NEXT: %tmp18 = add nuw nsw i64 %tmp8, 130; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%bb7> U: [1,2147483648) S: [1,2147483648) Exits: (zext i32 %arg2 to i64) LoopDispositions: { %bb7: Computable }31; CHECK-NEXT: Determining loop execution counts for: @foo32; CHECK-NEXT: Loop %bb7: backedge-taken count is (-1 + (zext i32 %arg2 to i64))<nsw>33; CHECK-NEXT: Loop %bb7: constant max backedge-taken count is i64 214748364634; CHECK-NEXT: Loop %bb7: symbolic max backedge-taken count is (-1 + (zext i32 %arg2 to i64))<nsw>35; CHECK-NEXT: Loop %bb7: Trip multiple is 136;37bb:38 %tmp = icmp sgt i32 %arg2, 039 br i1 %tmp, label %bb3, label %bb640 41bb3: ; preds = %bb42 %tmp4 = zext i32 %arg2 to i6443 br label %bb744 45bb5: ; preds = %bb746 br label %bb647 48bb6: ; preds = %bb5, %bb49 ret void50 51bb7: ; preds = %bb7, %bb352 %tmp8 = phi i64 [ %tmp18, %bb7 ], [ 0, %bb3 ]53 %tmp9 = shl i64 %tmp8, 3354 %tmp10 = ashr exact i64 %tmp9, 3255 %tmp11 = getelementptr inbounds i32, ptr %arg, i64 %tmp1056 %tmp12 = load i32, ptr %tmp11, align 457 %tmp13 = sub nsw i32 %tmp12, %arg158 store i32 %tmp13, ptr %tmp11, align 459 %tmp14 = or disjoint i64 %tmp10, 160 %tmp15 = getelementptr inbounds i32, ptr %arg, i64 %tmp1461 %tmp16 = load i32, ptr %tmp15, align 462 %tmp17 = mul nsw i32 %tmp16, %arg163 store i32 %tmp17, ptr %tmp15, align 464 %tmp18 = add nuw nsw i64 %tmp8, 165 %tmp19 = icmp eq i64 %tmp18, %tmp466 br i1 %tmp19, label %bb5, label %bb767}68 69define void @goo(ptr nocapture %arg3, i32 %arg4, i32 %arg5) {70; CHECK-LABEL: 'goo'71; CHECK-NEXT: Classifying expressions for: @goo72; CHECK-NEXT: %t4 = zext i32 %arg5 to i12873; CHECK-NEXT: --> (zext i32 %arg5 to i128) U: [0,4294967296) S: [0,4294967296)74; CHECK-NEXT: %t8 = phi i128 [ %t18, %bb7 ], [ 0, %bb3 ]75; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%bb7> U: [0,2147483647) S: [0,2147483647) Exits: (-1 + (zext i32 %arg5 to i128))<nsw> LoopDispositions: { %bb7: Computable }76; CHECK-NEXT: %t9 = shl i128 %t8, 10077; CHECK-NEXT: --> {0,+,1267650600228229401496703205376}<%bb7> U: [0,-1267650600228229401496703205375) S: [-170141183460469231731687303715884105728,170141182192818631503457902219180900353) Exits: (-1267650600228229401496703205376 + (1267650600228229401496703205376 * (zext i32 %arg5 to i128))) LoopDispositions: { %bb7: Computable }78; CHECK-NEXT: %t10 = ashr exact i128 %t9, 179; CHECK-NEXT: --> (sext i127 {0,+,633825300114114700748351602688}<%bb7> to i128) U: [0,-633825300114114700748351602687) S: [-85070591730234615865843651857942052864,85070591096409315751728951109590450177) Exits: (sext i127 (-633825300114114700748351602688 + (633825300114114700748351602688 * (zext i32 %arg5 to i127))) to i128) LoopDispositions: { %bb7: Computable }80; CHECK-NEXT: %t11 = getelementptr inbounds i32, ptr %arg3, i128 %t1081; CHECK-NEXT: --> %arg3 U: full-set S: full-set Exits: %arg3 LoopDispositions: { %bb7: Invariant }82; CHECK-NEXT: %t12 = load i32, ptr %t11, align 483; CHECK-NEXT: --> %t12 U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %bb7: Variant }84; CHECK-NEXT: %t13 = sub nsw i32 %t12, %arg485; CHECK-NEXT: --> ((-1 * %arg4) + %t12) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %bb7: Variant }86; CHECK-NEXT: %t14 = or disjoint i128 %t10, 187; CHECK-NEXT: --> (1 + (sext i127 {0,+,633825300114114700748351602688}<%bb7> to i128))<nuw><nsw> U: [1,-633825300114114700748351602686) S: [-85070591730234615865843651857942052863,85070591096409315751728951109590450178) Exits: (1 + (sext i127 (-633825300114114700748351602688 + (633825300114114700748351602688 * (zext i32 %arg5 to i127))) to i128))<nuw><nsw> LoopDispositions: { %bb7: Computable }88; CHECK-NEXT: %t15 = getelementptr inbounds i32, ptr %arg3, i128 %t1489; CHECK-NEXT: --> (4 + %arg3)<nuw> U: [4,0) S: [4,0) Exits: (4 + %arg3)<nuw> LoopDispositions: { %bb7: Invariant }90; CHECK-NEXT: %t16 = load i32, ptr %t15, align 491; CHECK-NEXT: --> %t16 U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %bb7: Variant }92; CHECK-NEXT: %t17 = mul nsw i32 %t16, %arg493; CHECK-NEXT: --> (%arg4 * %t16) U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %bb7: Variant }94; CHECK-NEXT: %t18 = add nuw nsw i128 %t8, 195; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%bb7> U: [1,2147483648) S: [1,2147483648) Exits: (zext i32 %arg5 to i128) LoopDispositions: { %bb7: Computable }96; CHECK-NEXT: Determining loop execution counts for: @goo97; CHECK-NEXT: Loop %bb7: backedge-taken count is (-1 + (zext i32 %arg5 to i128))<nsw>98; CHECK-NEXT: Loop %bb7: constant max backedge-taken count is i128 214748364699; CHECK-NEXT: Loop %bb7: symbolic max backedge-taken count is (-1 + (zext i32 %arg5 to i128))<nsw>100; CHECK-NEXT: Loop %bb7: Trip multiple is 1101;102bb:103 %t = icmp sgt i32 %arg5, 0104 br i1 %t, label %bb3, label %bb6105 106bb3: ; preds = %bb107 %t4 = zext i32 %arg5 to i128108 br label %bb7109 110bb5: ; preds = %bb7111 br label %bb6112 113bb6: ; preds = %bb5, %bb114 ret void115 116bb7: ; preds = %bb7, %bb3117 %t8 = phi i128 [ %t18, %bb7 ], [ 0, %bb3 ]118 %t9 = shl i128 %t8, 100119 %t10 = ashr exact i128 %t9, 1120 %t11 = getelementptr inbounds i32, ptr %arg3, i128 %t10121 %t12 = load i32, ptr %t11, align 4122 %t13 = sub nsw i32 %t12, %arg4123 store i32 %t13, ptr %t11, align 4124 %t14 = or disjoint i128 %t10, 1125 %t15 = getelementptr inbounds i32, ptr %arg3, i128 %t14126 %t16 = load i32, ptr %t15, align 4127 %t17 = mul nsw i32 %t16, %arg4128 store i32 %t17, ptr %t15, align 4129 %t18 = add nuw nsw i128 %t8, 1130 %t19 = icmp eq i128 %t18, %t4131 br i1 %t19, label %bb5, label %bb7132}133