AMDGPU/SI: Add SI Machine Scheduler
[oota-llvm.git] / test / Transforms / IndVarSimplify / lftr-extend-const.ll
1 ;RUN: opt -S %s -indvars | FileCheck %s
2
3 ; Provide legal integer types.
4 target datalayout = "n8:16:32:64"
5
6
7 ; CHECK-LABEL: @foo(
8 ; CHECK-NOT: %lftr.wideiv = trunc i32 %indvars.iv.next to i16
9 ; CHECK: %exitcond = icmp ne i32 %indvars.iv.next, 512
10 define void @foo() #0 {
11 entry:
12   br label %for.body
13
14 for.body:                                         ; preds = %entry, %for.body
15   %i.01 = phi i16 [ 0, %entry ], [ %inc, %for.body ]
16   %conv2 = sext i16 %i.01 to i32
17   call void @bar(i32 %conv2) #1
18   %inc = add i16 %i.01, 1
19   %cmp = icmp slt i16 %inc, 512
20   br i1 %cmp, label %for.body, label %for.end
21
22 for.end:                                          ; preds = %for.body
23   ret void
24 }
25
26 ; Check that post-incrementing the backedge taken count does not overflow.
27 ; CHECK-LABEL: @postinc(
28 ; CHECK: icmp eq i32 %indvars.iv, 255
29 define i32 @postinc() #0 {
30 entry:
31   br label %do.body
32
33 do.body:                                          ; preds = %do.body, %entry
34   %first.0 = phi i8 [ 0, %entry ], [ %inc, %do.body ]
35   %conv = zext i8 %first.0 to i32
36   call void  @bar(i32 %conv) #1
37   %inc = add i8 %first.0, 1
38   %cmp = icmp eq i8 %first.0, -1
39   br i1 %cmp, label %do.end, label %do.body
40
41 do.end:                                           ; preds = %do.body
42   ret i32 0
43 }
44
45 declare void @bar(i32)
46
47 attributes #0 = { nounwind uwtable }
48 attributes #1 = { nounwind }