| ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5 |
| ; RUN: opt -passes='print<scalar-evolution>' -disable-output %s 2>&1 | FileCheck %s |
| |
| declare i1 @cond() |
| |
| define void @test_push_constant_into_zext(ptr %dst, ptr %src, i32 %n, i64 %offset) { |
| ; CHECK-LABEL: 'test_push_constant_into_zext' |
| ; CHECK-NEXT: Classifying expressions for: @test_push_constant_into_zext |
| ; CHECK-NEXT: %outer.ptr = phi ptr [ %src, %entry ], [ %ptr.iv.next, %inner.loop ] |
| ; CHECK-NEXT: --> %outer.ptr U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %outer.loop: Variant, %inner.loop: Invariant } |
| ; CHECK-NEXT: %c = call i1 @cond() |
| ; CHECK-NEXT: --> %c U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %outer.loop: Variant, %inner.loop: Invariant } |
| ; CHECK-NEXT: %iv = phi i32 [ 0, %outer.loop ], [ %iv.next, %inner.loop ] |
| ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%inner.loop> U: [0,2147483647) S: [0,2147483647) Exits: (-1 + (1 smax %n))<nsw> LoopDispositions: { %inner.loop: Computable, %outer.loop: Variant } |
| ; CHECK-NEXT: %ptr.iv = phi ptr [ %src, %outer.loop ], [ %ptr.iv.next, %inner.loop ] |
| ; CHECK-NEXT: --> {%src,+,%offset}<%inner.loop> U: full-set S: full-set Exits: (((zext i32 (-1 + (1 smax %n))<nsw> to i64) * %offset) + %src) LoopDispositions: { %inner.loop: Computable, %outer.loop: Variant } |
| ; CHECK-NEXT: %l = load i8, ptr %outer.ptr, align 1 |
| ; CHECK-NEXT: --> %l U: full-set S: full-set Exits: <<Unknown>> LoopDispositions: { %inner.loop: Variant, %outer.loop: Variant } |
| ; CHECK-NEXT: %ptr.iv.next = getelementptr i8, ptr %ptr.iv, i64 %offset |
| ; CHECK-NEXT: --> {(%offset + %src),+,%offset}<%inner.loop> U: full-set S: full-set Exits: (((zext i32 (1 smax %n) to i64) * %offset) + %src) LoopDispositions: { %inner.loop: Computable, %outer.loop: Variant } |
| ; CHECK-NEXT: %iv.next = add i32 %iv, 1 |
| ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%inner.loop> U: [1,-2147483648) S: [1,-2147483648) Exits: (1 smax %n) LoopDispositions: { %inner.loop: Computable, %outer.loop: Variant } |
| ; CHECK-NEXT: Determining loop execution counts for: @test_push_constant_into_zext |
| ; CHECK-NEXT: Loop %inner.loop: backedge-taken count is (-1 + (1 smax %n))<nsw> |
| ; CHECK-NEXT: Loop %inner.loop: constant max backedge-taken count is i32 2147483646 |
| ; CHECK-NEXT: Loop %inner.loop: symbolic max backedge-taken count is (-1 + (1 smax %n))<nsw> |
| ; CHECK-NEXT: Loop %inner.loop: Trip multiple is 1 |
| ; CHECK-NEXT: Loop %outer.loop: Unpredictable backedge-taken count. |
| ; CHECK-NEXT: Loop %outer.loop: Unpredictable constant max backedge-taken count. |
| ; CHECK-NEXT: Loop %outer.loop: Unpredictable symbolic max backedge-taken count. |
| ; |
| entry: |
| br label %outer.loop |
| |
| outer.loop: |
| %outer.ptr = phi ptr [ %src, %entry ], [ %ptr.iv.next, %inner.loop ] |
| %c = call i1 @cond() |
| br i1 %c, label %inner.loop, label %exit |
| |
| inner.loop: |
| %iv = phi i32 [ 0, %outer.loop ], [ %iv.next, %inner.loop ] |
| %ptr.iv = phi ptr [ %src, %outer.loop ], [ %ptr.iv.next, %inner.loop ] |
| %l = load i8, ptr %outer.ptr, align 1 |
| %ptr.iv.next = getelementptr i8, ptr %ptr.iv, i64 %offset |
| store i8 %l, ptr %dst, align 2 |
| %iv.next = add i32 %iv, 1 |
| %ec = icmp slt i32 %iv.next, %n |
| br i1 %ec, label %inner.loop, label %outer.loop |
| |
| exit: |
| ret void |
| } |