40 lines · plain
1; RUN: opt < %s -disable-output "-passes=print<iv-users>" -S 2>&1 | FileCheck %s2 3; This is a regression test for the commit rL327362.4 5target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128-ni:1"6target triple = "x86_64-unknown-linux-gnu"7 8define void @test(i64 %a, ptr %p) {9entry:10 br label %first_loop11 12first_loop:13 %i = phi i64 [20, %entry], [%i.next, %first_loop]14 %i.next = add nuw nsw i64 %i, 115 %cond1 = icmp ult i64 %i.next, %a16 br i1 %cond1, label %first_loop, label %middle_block17 18middle_block:19 %b = load i64, ptr %p20 %cmp = icmp ult i64 %i, %b21; When SCEV will try to compute the initial value for %j22; it will observe umax generated by this select.23; When it will try to simplify this umax it will invoke24; isKnownPredicate with AddRec for %i and unknown SCEV for %b.25; As a result we find MDL == first_loop where %b is not available26; at loop entry.27; CHECK: IV Users for loop %second_loop with backedge-taken count{{.*}}umax28 %s = select i1 %cmp, i64 %i, i64 %b29 br label %second_loop30 31second_loop:32 %j = phi i64 [%s, %middle_block], [%j.next, %second_loop]33 %j.next = add nuw nsw i64 %j, 134 %cond2 = icmp ult i64 %j.next, 10035 br i1 %cond2, label %second_loop, label %return36 37return:38 ret void39}40