1 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt -disable-output -passes='print<scalar-evolution>' -verify-scev < %s 2>&1 | FileCheck %s
4 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2"
5 target triple = "x86_64-unknown-linux-gnu"
7 ; print<scalar-evolution> is used to compute SCEVs for all values in the
9 ; We should not crash on multiplicative inverse called within SCEV's binomial
10 ; coefficient function.
12 define i32 @pr87798() {
13 ; CHECK-LABEL: 'pr87798'
14 ; CHECK-NEXT: Classifying expressions for: @pr87798
15 ; CHECK-NEXT: %phi = phi i32 [ 0, %bb ], [ %add4, %bb1 ]
16 ; CHECK-NEXT: --> {0,+,0,+,0,+,2,+,3}<%bb1> U: full-set S: full-set Exits: 0 LoopDispositions: { %bb1: Computable }
17 ; CHECK-NEXT: %phi2 = phi i32 [ 0, %bb ], [ %add, %bb1 ]
18 ; CHECK-NEXT: --> {0,+,0,+,1}<%bb1> U: full-set S: full-set Exits: 0 LoopDispositions: { %bb1: Computable }
19 ; CHECK-NEXT: %phi3 = phi i32 [ 0, %bb ], [ %add5, %bb1 ]
20 ; CHECK-NEXT: --> {0,+,1}<nuw><nsw><%bb1> U: [0,1) S: [0,1) Exits: 0 LoopDispositions: { %bb1: Computable }
21 ; CHECK-NEXT: %add = add i32 %phi2, %phi3
22 ; CHECK-NEXT: --> {0,+,1,+,1}<%bb1> U: full-set S: full-set Exits: 0 LoopDispositions: { %bb1: Computable }
23 ; CHECK-NEXT: %mul = mul i32 %phi2, %phi3
24 ; CHECK-NEXT: --> {0,+,0,+,2,+,3}<%bb1> U: full-set S: full-set Exits: 0 LoopDispositions: { %bb1: Computable }
25 ; CHECK-NEXT: %add4 = add i32 %mul, %phi
26 ; CHECK-NEXT: --> {0,+,0,+,2,+,5,+,3}<%bb1> U: full-set S: full-set Exits: 0 LoopDispositions: { %bb1: Computable }
27 ; CHECK-NEXT: %and = and i32 %phi, 1
28 ; CHECK-NEXT: --> (zext i1 {false,+,false,+,false,+,false,+,true}<%bb1> to i32) U: [0,2) S: [0,2) Exits: 0 LoopDispositions: { %bb1: Computable }
29 ; CHECK-NEXT: %add5 = add i32 %phi3, 1
30 ; CHECK-NEXT: --> {1,+,1}<nuw><nsw><%bb1> U: [1,2) S: [1,2) Exits: 1 LoopDispositions: { %bb1: Computable }
31 ; CHECK-NEXT: %phi9 = phi i32 [ %and, %bb1 ]
32 ; CHECK-NEXT: --> (zext i1 {false,+,false,+,false,+,false,+,true}<%bb1> to i32) U: [0,2) S: [0,2) --> 0 U: [0,1) S: [0,1)
33 ; CHECK-NEXT: %zext = zext i32 %phi9 to i64
34 ; CHECK-NEXT: --> poison U: full-set S: full-set
35 ; CHECK-NEXT: Determining loop execution counts for: @pr87798
36 ; CHECK-NEXT: Loop %loop: <multiple exits> Unpredictable backedge-taken count.
37 ; CHECK-NEXT: Loop %loop: Unpredictable constant max backedge-taken count.
38 ; CHECK-NEXT: Loop %loop: Unpredictable symbolic max backedge-taken count.
39 ; CHECK-NEXT: Loop %bb1: backedge-taken count is i1 false
40 ; CHECK-NEXT: Loop %bb1: constant max backedge-taken count is i1 false
41 ; CHECK-NEXT: Loop %bb1: symbolic max backedge-taken count is i1 false
42 ; CHECK-NEXT: Loop %bb1: Trip multiple is 1
47 bb1: ; preds = %bb1, %bb
48 %phi = phi i32 [ 0, %bb ], [ %add4, %bb1 ]
49 %phi2 = phi i32 [ 0, %bb ], [ %add, %bb1 ]
50 %phi3 = phi i32 [ 0, %bb ], [ %add5, %bb1 ]
51 %add = add i32 %phi2, %phi3
52 %mul = mul i32 %phi2, %phi3
53 %add4 = add i32 %mul, %phi
54 %and = and i32 %phi, 1
55 %add5 = add i32 %phi3, 1
56 br i1 true, label %preheader, label %bb1
58 preheader: ; preds = %bb1
59 %phi9 = phi i32 [ %and, %bb1 ]
62 loop: ; preds = %preheader, %loop
65 bb7: ; No predecessors!
66 %zext = zext i32 %phi9 to i64