inf-recursion.ll 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ; RUN: opt < %s -tailcallelim -S | FileCheck %s
  2. ; Don't turn this into an infinite loop, this is probably the implementation
  3. ; of fabs and we expect the codegen to lower fabs.
  4. ; CHECK: @fabs(double %f)
  5. ; CHECK: call
  6. ; CHECK: ret
  7. define double @fabs(double %f) {
  8. entry:
  9. %tmp2 = call double @fabs( double %f ) ; <double> [#uses=1]
  10. ret double %tmp2
  11. }
  12. ; Do turn other calls into infinite loops though.
  13. ; CHECK-LABEL: define double @foo(
  14. ; CHECK-NOT: call
  15. ; CHECK: }
  16. define double @foo(double %f) {
  17. %t= call double @foo(double %f)
  18. ret double %t
  19. }
  20. ; CHECK-LABEL: define float @fabsf(
  21. ; CHECK-NOT: call
  22. ; CHECK: }
  23. define float @fabsf(float %f) {
  24. %t= call float @fabsf(float 2.0)
  25. ret float %t
  26. }
  27. declare x86_fp80 @fabsl(x86_fp80 %f)
  28. ; Don't crash while transforming a function with infinite recursion.
  29. define i32 @PR22704(i1 %bool) {
  30. entry:
  31. br i1 %bool, label %t, label %f
  32. t:
  33. %call1 = call i32 @PR22704(i1 1)
  34. br label %return
  35. f:
  36. %call = call i32 @PR22704(i1 1)
  37. br label %return
  38. return:
  39. ret i32 0
  40. ; CHECK-LABEL: @PR22704(
  41. ; CHECK: %bool.tr = phi i1 [ %bool, %entry ], [ true, %t ], [ true, %f ]
  42. ; CHECK: br i1 %bool.tr, label %t, label %f
  43. }