signed-trip-count.ll 908 B

12345678910111213141516171819202122232425262728293031323334
  1. ; RUN: opt < %s -indvars -S > %t
  2. ; RUN: not grep sext %t
  3. ; RUN: grep phi %t | count 1
  4. ; Provide legal integer types.
  5. target datalayout = "n8:16:32:64"
  6. define void @foo(i64* nocapture %x, i32 %n) nounwind {
  7. entry:
  8. %tmp102 = icmp sgt i32 %n, 0 ; <i1> [#uses=1]
  9. br i1 %tmp102, label %bb.nph, label %return
  10. bb.nph: ; preds = %entry
  11. br label %bb
  12. bb: ; preds = %bb7, %bb.nph
  13. %i.01 = phi i32 [ %tmp6, %bb7 ], [ 0, %bb.nph ] ; <i32> [#uses=3]
  14. %tmp1 = sext i32 %i.01 to i64 ; <i64> [#uses=1]
  15. %tmp4 = getelementptr i64, i64* %x, i32 %i.01 ; <i64*> [#uses=1]
  16. store i64 %tmp1, i64* %tmp4, align 8
  17. %tmp6 = add i32 %i.01, 1 ; <i32> [#uses=2]
  18. br label %bb7
  19. bb7: ; preds = %bb
  20. %tmp10 = icmp slt i32 %tmp6, %n ; <i1> [#uses=1]
  21. br i1 %tmp10, label %bb, label %bb7.return_crit_edge
  22. bb7.return_crit_edge: ; preds = %bb7
  23. br label %return
  24. return: ; preds = %bb7.return_crit_edge, %entry
  25. ret void
  26. }