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 3 4; check -mattr=-slow-incdec 5; INCDEC-NOT: addl $-1 6; INCDEC: dec 7; INCDEC-NOT: addl $1 8; INCDEC: inc 9 10; check -mattr=+slow-incdec 11; ADD: addl $-1 12; ADD-NOT: dec 13; ADD: addl $1 14; ADD-NOT: inc 15 16; Function Attrs: nounwind readonly 17define i32 @slow_1(i32* nocapture readonly %a, i32 %s) #0 { 18entry: 19 %cmp5 = icmp eq i32 %s, 0 20 br i1 %cmp5, label %for.end, label %for.body.preheader 21 22for.body.preheader: ; preds = %entry 23 br label %for.body 24 25for.cond: ; preds = %for.body 26 %cmp = icmp eq i32 %dec, 0 27 br i1 %cmp, label %for.end.loopexit, label %for.body 28 29for.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 34; 35 %dec = add nsw i32 %i.06, -1 36 br i1 %cmp1, label %for.end.loopexit, label %for.cond 37 38for.end.loopexit: ; preds = %for.cond, %for.body 39 %i.0.lcssa.ph = phi i32 [ 0, %for.cond ], [ %i.06, %for.body ] 40 br label %for.end 41 42for.end: ; preds = %for.end.loopexit, %entry 43 %i.0.lcssa = phi i32 [ 0, %entry ], [ %i.0.lcssa.ph, %for.end.loopexit ] 44 ret i32 %i.0.lcssa 45} 46 47; Function Attrs: nounwind readonly 48define i32 @slow_2(i32* nocapture readonly %a, i32 %s) #0 { 49entry: 50 %cmp5 = icmp eq i32 %s, 0 51 br i1 %cmp5, label %for.end, label %for.body.preheader 52 53for.body.preheader: ; preds = %entry 54 br label %for.body 55 56for.cond: ; preds = %for.body 57 %cmp = icmp eq i32 %inc, 0 58 br i1 %cmp, label %for.end.loopexit, label %for.body 59 60for.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 67 68for.end.loopexit: ; preds = %for.cond, %for.body 69 %i.0.lcssa.ph = phi i32 [ 0, %for.cond ], [ %i.06, %for.body ] 70 br label %for.end 71 72for.end: ; preds = %for.end.loopexit, %entry 73 %i.0.lcssa = phi i32 [ 0, %entry ], [ %i.0.lcssa.ph, %for.end.loopexit ] 74 ret i32 %i.0.lcssa 75} 76 77!1 = !{!2, !2, i64 0} 78!2 = !{!"int", !3, i64 0} 79!3 = !{!"omnipotent char", !4, i64 0} 80!4 = !{!"Simple C/C++ TBAA"} 81