2013-07-13 06:08:48 +08:00
|
|
|
;RUN: opt -S %s -indvars | FileCheck %s
|
|
|
|
|
2015-03-05 02:43:29 +08:00
|
|
|
; Provide legal integer types.
|
|
|
|
target datalayout = "n8:16:32:64"
|
|
|
|
|
|
|
|
|
2014-01-12 05:06:00 +08:00
|
|
|
; CHECK-LABEL: @foo(
|
2013-07-13 06:08:48 +08:00
|
|
|
; CHECK-NOT: %lftr.wideiv = trunc i32 %indvars.iv.next to i16
|
2014-11-18 10:20:58 +08:00
|
|
|
; CHECK: %exitcond = icmp ne i32 %indvars.iv.next, 512
|
2013-07-13 06:08:48 +08:00
|
|
|
define void @foo() #0 {
|
|
|
|
entry:
|
|
|
|
br label %for.body
|
|
|
|
|
|
|
|
for.body: ; preds = %entry, %for.body
|
|
|
|
%i.01 = phi i16 [ 0, %entry ], [ %inc, %for.body ]
|
|
|
|
%conv2 = sext i16 %i.01 to i32
|
|
|
|
call void @bar(i32 %conv2) #1
|
|
|
|
%inc = add i16 %i.01, 1
|
|
|
|
%cmp = icmp slt i16 %inc, 512
|
|
|
|
br i1 %cmp, label %for.body, label %for.end
|
|
|
|
|
|
|
|
for.end: ; preds = %for.body
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Check that post-incrementing the backedge taken count does not overflow.
|
2014-01-12 05:06:00 +08:00
|
|
|
; CHECK-LABEL: @postinc(
|
2014-09-04 07:03:18 +08:00
|
|
|
; CHECK: icmp eq i32 %indvars.iv, 255
|
2013-07-13 06:08:48 +08:00
|
|
|
define i32 @postinc() #0 {
|
|
|
|
entry:
|
|
|
|
br label %do.body
|
|
|
|
|
|
|
|
do.body: ; preds = %do.body, %entry
|
|
|
|
%first.0 = phi i8 [ 0, %entry ], [ %inc, %do.body ]
|
|
|
|
%conv = zext i8 %first.0 to i32
|
|
|
|
call void @bar(i32 %conv) #1
|
|
|
|
%inc = add i8 %first.0, 1
|
|
|
|
%cmp = icmp eq i8 %first.0, -1
|
|
|
|
br i1 %cmp, label %do.end, label %do.body
|
|
|
|
|
|
|
|
do.end: ; preds = %do.body
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @bar(i32)
|
|
|
|
|
|
|
|
attributes #0 = { nounwind uwtable }
|
|
|
|
attributes #1 = { nounwind }
|