1 ; RUN: llc -mtriple=i386-unknown-linux-gnu -mattr=-slow-incdec < %s | FileCheck -check-prefix=INCDEC %s
2 ; RUN: llc -mtriple=i386-unknown-linux-gnu -mattr=+slow-incdec < %s | FileCheck -check-prefix=ADD %s
4 ; check -mattr=-slow-incdec
10 ; check -mattr=+slow-incdec
16 ; Function Attrs: nounwind readonly
17 define i32 @slow_1(i32* nocapture readonly %a, i32 %s) #0 {
19 %cmp5 = icmp eq i32 %s, 0
20 br i1 %cmp5, label %for.end, label %for.body.preheader
22 for.body.preheader: ; preds = %entry
25 for.cond: ; preds = %for.body
26 %cmp = icmp eq i32 %dec, 0
27 br i1 %cmp, label %for.end.loopexit, label %for.body
29 for.body: ; preds = %for.body.preheader, %for.cond
30 %i.06 = phi i32 [ %dec, %for.cond ], [ %s, %for.body.preheader ]
31 %arrayidx = getelementptr inbounds i32, i32* %a, i32 %i.06
32 %0 = load i32, i32* %arrayidx, align 4, !tbaa !1
33 %cmp1 = icmp eq i32 %0, 0
35 %dec = add nsw i32 %i.06, -1
36 br i1 %cmp1, label %for.end.loopexit, label %for.cond
38 for.end.loopexit: ; preds = %for.cond, %for.body
39 %i.0.lcssa.ph = phi i32 [ 0, %for.cond ], [ %i.06, %for.body ]
42 for.end: ; preds = %for.end.loopexit, %entry
43 %i.0.lcssa = phi i32 [ 0, %entry ], [ %i.0.lcssa.ph, %for.end.loopexit ]
47 ; Function Attrs: nounwind readonly
48 define i32 @slow_2(i32* nocapture readonly %a, i32 %s) #0 {
50 %cmp5 = icmp eq i32 %s, 0
51 br i1 %cmp5, label %for.end, label %for.body.preheader
53 for.body.preheader: ; preds = %entry
56 for.cond: ; preds = %for.body
57 %cmp = icmp eq i32 %inc, 0
58 br i1 %cmp, label %for.end.loopexit, label %for.body
60 for.body: ; preds = %for.body.preheader, %for.cond
61 %i.06 = phi i32 [ %inc, %for.cond ], [ %s, %for.body.preheader ]
62 %arrayidx = getelementptr inbounds i32, i32* %a, i32 %i.06
63 %0 = load i32, i32* %arrayidx, align 4, !tbaa !1
64 %cmp1 = icmp eq i32 %0, 0
65 %inc = add nsw i32 %i.06, 1
66 br i1 %cmp1, label %for.end.loopexit, label %for.cond
68 for.end.loopexit: ; preds = %for.cond, %for.body
69 %i.0.lcssa.ph = phi i32 [ 0, %for.cond ], [ %i.06, %for.body ]
72 for.end: ; preds = %for.end.loopexit, %entry
73 %i.0.lcssa = phi i32 [ 0, %entry ], [ %i.0.lcssa.ph, %for.end.loopexit ]
78 !2 = !{!"int", !3, i64 0}
79 !3 = !{!"omnipotent char", !4, i64 0}
80 !4 = !{!"Simple C/C++ TBAA"}