forked from OSchip/llvm-project
[SCEV] Add a testcase for zero max btc with non-constant exact btc
Reduced from the ArchiveCommandLine.ll case seen in D108848.
This commit is contained in:
parent
4bb5f44c70
commit
c49503a76d
|
@ -517,3 +517,38 @@ loop:
|
|||
exit:
|
||||
ret void
|
||||
}
|
||||
|
||||
; This is a case where our max-backedge taken count logic happens to be
|
||||
; able to prove a zero btc, but our symbolic logic doesn't due to a lack
|
||||
; of context sensativity.
|
||||
define void @ne_zero_max_btc(i32 %a) {
|
||||
; CHECK-LABEL: Determining loop execution counts for: @ne_zero_max_btc
|
||||
; CHECK: Loop %for.body: backedge-taken count is (-1 + (zext i32 (1 umax (1 smin %a)) to i64))<nsw>
|
||||
; CHECK: Loop %for.body: max backedge-taken count is 0
|
||||
entry:
|
||||
%cmp = icmp slt i32 %a, 1
|
||||
%spec.select = select i1 %cmp, i32 %a, i32 1
|
||||
%cmp8 = icmp sgt i32 %a, 0
|
||||
br i1 %cmp8, label %for.body.preheader, label %loopexit
|
||||
|
||||
for.body.preheader: ; preds = %if.then4.i.i
|
||||
%umax = call i32 @llvm.umax.i32(i32 %spec.select, i32 1)
|
||||
%umax.i.i = zext i32 %umax to i64
|
||||
br label %for.body
|
||||
|
||||
for.body: ; preds = %for.inc, %for.body.preheader
|
||||
%indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.inc ]
|
||||
call void @unknown()
|
||||
br label %for.inc
|
||||
|
||||
for.inc: ; preds = %for.body
|
||||
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
|
||||
%exitcond.i.not.i534 = icmp ne i64 %indvars.iv.next, %umax.i.i
|
||||
br i1 %exitcond.i.not.i534, label %for.body, label %loopexit
|
||||
|
||||
loopexit:
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @unknown()
|
||||
declare i32 @llvm.umax.i32(i32, i32)
|
||||
|
|
Loading…
Reference in New Issue