iv-sext.ll 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. ; RUN: opt < %s -indvars -S | FileCheck %s
  2. ; Indvars should be able to promote the hiPart induction variable in the
  3. ; inner loop to i64.
  4. ; TODO: it should promote hiPart to i64 in the outer loop too.
  5. target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n32:64"
  6. define void @t(float* %pTmp1, float* %peakWeight, float* %nrgReducePeakrate, i32 %bandEdgeIndex, float %tmp1) nounwind {
  7. entry:
  8. %tmp = load float, float* %peakWeight, align 4 ; <float> [#uses=1]
  9. %tmp2 = icmp sgt i32 %bandEdgeIndex, 0 ; <i1> [#uses=1]
  10. br i1 %tmp2, label %bb.nph22, label %return
  11. bb.nph22: ; preds = %entry
  12. %tmp3 = add i32 %bandEdgeIndex, -1 ; <i32> [#uses=2]
  13. br label %bb
  14. ; CHECK: bb:
  15. ; CHECK: phi i64
  16. ; CHECK-NOT: phi i64
  17. bb: ; preds = %bb8, %bb.nph22
  18. %distERBhi.121 = phi float [ %distERBhi.2.lcssa, %bb8 ], [ 0.000000e+00, %bb.nph22 ] ; <float> [#uses=2]
  19. %distERBlo.120 = phi float [ %distERBlo.0.lcssa, %bb8 ], [ 0.000000e+00, %bb.nph22 ] ; <float> [#uses=2]
  20. %hiPart.119 = phi i32 [ %hiPart.0.lcssa, %bb8 ], [ 0, %bb.nph22 ] ; <i32> [#uses=3]
  21. %loPart.118 = phi i32 [ %loPart.0.lcssa, %bb8 ], [ 0, %bb.nph22 ] ; <i32> [#uses=2]
  22. %peakCount.117 = phi float [ %peakCount.2.lcssa, %bb8 ], [ %tmp, %bb.nph22 ] ; <float> [#uses=2]
  23. %part.016 = phi i32 [ %tmp46, %bb8 ], [ 0, %bb.nph22 ] ; <i32> [#uses=5]
  24. %tmp4 = icmp sgt i32 %part.016, 0 ; <i1> [#uses=1]
  25. br i1 %tmp4, label %bb1, label %bb3.preheader
  26. ; CHECK: bb1:
  27. bb1: ; preds = %bb
  28. %tmp5 = add i32 %part.016, -1 ; <i32> [#uses=1]
  29. %tmp6 = sext i32 %tmp5 to i64 ; <i64> [#uses=1]
  30. %tmp7 = getelementptr float, float* %pTmp1, i64 %tmp6 ; <float*> [#uses=1]
  31. %tmp8 = load float, float* %tmp7, align 4 ; <float> [#uses=1]
  32. %tmp9 = fadd float %tmp8, %distERBlo.120 ; <float> [#uses=1]
  33. %tmp10 = add i32 %part.016, -1 ; <i32> [#uses=1]
  34. %tmp11 = sext i32 %tmp10 to i64 ; <i64> [#uses=1]
  35. %tmp12 = getelementptr float, float* %pTmp1, i64 %tmp11 ; <float*> [#uses=1]
  36. %tmp13 = load float, float* %tmp12, align 4 ; <float> [#uses=1]
  37. %tmp14 = fsub float %distERBhi.121, %tmp13 ; <float> [#uses=1]
  38. br label %bb3.preheader
  39. bb3.preheader: ; preds = %bb1, %bb
  40. %distERBlo.0.ph = phi float [ %distERBlo.120, %bb ], [ %tmp9, %bb1 ] ; <float> [#uses=3]
  41. %distERBhi.0.ph = phi float [ %distERBhi.121, %bb ], [ %tmp14, %bb1 ] ; <float> [#uses=3]
  42. %tmp15 = fcmp ogt float %distERBlo.0.ph, 2.500000e+00 ; <i1> [#uses=1]
  43. br i1 %tmp15, label %bb.nph, label %bb5.preheader
  44. bb.nph: ; preds = %bb3.preheader
  45. br label %bb2
  46. bb2: ; preds = %bb3, %bb.nph
  47. %distERBlo.03 = phi float [ %tmp19, %bb3 ], [ %distERBlo.0.ph, %bb.nph ] ; <float> [#uses=1]
  48. %loPart.02 = phi i32 [ %tmp24, %bb3 ], [ %loPart.118, %bb.nph ] ; <i32> [#uses=3]
  49. %peakCount.01 = phi float [ %tmp23, %bb3 ], [ %peakCount.117, %bb.nph ] ; <float> [#uses=1]
  50. %tmp16 = sext i32 %loPart.02 to i64 ; <i64> [#uses=1]
  51. %tmp17 = getelementptr float, float* %pTmp1, i64 %tmp16 ; <float*> [#uses=1]
  52. %tmp18 = load float, float* %tmp17, align 4 ; <float> [#uses=1]
  53. %tmp19 = fsub float %distERBlo.03, %tmp18 ; <float> [#uses=3]
  54. %tmp20 = sext i32 %loPart.02 to i64 ; <i64> [#uses=1]
  55. %tmp21 = getelementptr float, float* %peakWeight, i64 %tmp20 ; <float*> [#uses=1]
  56. %tmp22 = load float, float* %tmp21, align 4 ; <float> [#uses=1]
  57. %tmp23 = fsub float %peakCount.01, %tmp22 ; <float> [#uses=2]
  58. %tmp24 = add i32 %loPart.02, 1 ; <i32> [#uses=2]
  59. br label %bb3
  60. bb3: ; preds = %bb2
  61. %tmp25 = fcmp ogt float %tmp19, 2.500000e+00 ; <i1> [#uses=1]
  62. br i1 %tmp25, label %bb2, label %bb3.bb5.preheader_crit_edge
  63. bb3.bb5.preheader_crit_edge: ; preds = %bb3
  64. %tmp24.lcssa = phi i32 [ %tmp24, %bb3 ] ; <i32> [#uses=1]
  65. %tmp23.lcssa = phi float [ %tmp23, %bb3 ] ; <float> [#uses=1]
  66. %tmp19.lcssa = phi float [ %tmp19, %bb3 ] ; <float> [#uses=1]
  67. br label %bb5.preheader
  68. bb5.preheader: ; preds = %bb3.bb5.preheader_crit_edge, %bb3.preheader
  69. %distERBlo.0.lcssa = phi float [ %tmp19.lcssa, %bb3.bb5.preheader_crit_edge ], [ %distERBlo.0.ph, %bb3.preheader ] ; <float> [#uses=2]
  70. %loPart.0.lcssa = phi i32 [ %tmp24.lcssa, %bb3.bb5.preheader_crit_edge ], [ %loPart.118, %bb3.preheader ] ; <i32> [#uses=1]
  71. %peakCount.0.lcssa = phi float [ %tmp23.lcssa, %bb3.bb5.preheader_crit_edge ], [ %peakCount.117, %bb3.preheader ] ; <float> [#uses=2]
  72. %.not10 = fcmp olt float %distERBhi.0.ph, 2.500000e+00 ; <i1> [#uses=1]
  73. %tmp26 = icmp sgt i32 %tmp3, %hiPart.119 ; <i1> [#uses=1]
  74. %or.cond11 = and i1 %tmp26, %.not10 ; <i1> [#uses=1]
  75. br i1 %or.cond11, label %bb.nph12, label %bb7
  76. bb.nph12: ; preds = %bb5.preheader
  77. br label %bb4
  78. ; CHECK: bb4:
  79. ; CHECK: phi i64
  80. ; CHECK-NOT: phi i64
  81. ; CHECK-NOT: sext
  82. bb4: ; preds = %bb5, %bb.nph12
  83. %distERBhi.29 = phi float [ %tmp30, %bb5 ], [ %distERBhi.0.ph, %bb.nph12 ] ; <float> [#uses=1]
  84. %hiPart.08 = phi i32 [ %tmp31, %bb5 ], [ %hiPart.119, %bb.nph12 ] ; <i32> [#uses=2]
  85. %peakCount.27 = phi float [ %tmp35, %bb5 ], [ %peakCount.0.lcssa, %bb.nph12 ] ; <float> [#uses=1]
  86. %tmp27 = sext i32 %hiPart.08 to i64 ; <i64> [#uses=1]
  87. %tmp28 = getelementptr float, float* %pTmp1, i64 %tmp27 ; <float*> [#uses=1]
  88. %tmp29 = load float, float* %tmp28, align 4 ; <float> [#uses=1]
  89. %tmp30 = fadd float %tmp29, %distERBhi.29 ; <float> [#uses=3]
  90. %tmp31 = add i32 %hiPart.08, 1 ; <i32> [#uses=4]
  91. %tmp32 = sext i32 %tmp31 to i64 ; <i64> [#uses=1]
  92. %tmp33 = getelementptr float, float* %peakWeight, i64 %tmp32 ; <float*> [#uses=1]
  93. %tmp34 = load float, float* %tmp33, align 4 ; <float> [#uses=1]
  94. %tmp35 = fadd float %tmp34, %peakCount.27 ; <float> [#uses=2]
  95. br label %bb5
  96. ; CHECK: bb5:
  97. bb5: ; preds = %bb4
  98. %.not = fcmp olt float %tmp30, 2.500000e+00 ; <i1> [#uses=1]
  99. %tmp36 = icmp sgt i32 %tmp3, %tmp31 ; <i1> [#uses=1]
  100. %or.cond = and i1 %tmp36, %.not ; <i1> [#uses=1]
  101. br i1 %or.cond, label %bb4, label %bb5.bb7_crit_edge
  102. bb5.bb7_crit_edge: ; preds = %bb5
  103. %tmp35.lcssa = phi float [ %tmp35, %bb5 ] ; <float> [#uses=1]
  104. %tmp31.lcssa = phi i32 [ %tmp31, %bb5 ] ; <i32> [#uses=1]
  105. %tmp30.lcssa = phi float [ %tmp30, %bb5 ] ; <float> [#uses=1]
  106. br label %bb7
  107. bb7: ; preds = %bb5.bb7_crit_edge, %bb5.preheader
  108. %distERBhi.2.lcssa = phi float [ %tmp30.lcssa, %bb5.bb7_crit_edge ], [ %distERBhi.0.ph, %bb5.preheader ] ; <float> [#uses=2]
  109. %hiPart.0.lcssa = phi i32 [ %tmp31.lcssa, %bb5.bb7_crit_edge ], [ %hiPart.119, %bb5.preheader ] ; <i32> [#uses=1]
  110. %peakCount.2.lcssa = phi float [ %tmp35.lcssa, %bb5.bb7_crit_edge ], [ %peakCount.0.lcssa, %bb5.preheader ] ; <float> [#uses=2]
  111. %tmp37 = fadd float %distERBlo.0.lcssa, %distERBhi.2.lcssa ; <float> [#uses=1]
  112. %tmp38 = fdiv float %peakCount.2.lcssa, %tmp37 ; <float> [#uses=1]
  113. %tmp39 = fmul float %tmp38, %tmp1 ; <float> [#uses=2]
  114. %tmp40 = fmul float %tmp39, %tmp39 ; <float> [#uses=2]
  115. %tmp41 = fmul float %tmp40, %tmp40 ; <float> [#uses=1]
  116. %tmp42 = fadd float %tmp41, 1.000000e+00 ; <float> [#uses=1]
  117. %tmp43 = fdiv float 1.000000e+00, %tmp42 ; <float> [#uses=1]
  118. %tmp44 = sext i32 %part.016 to i64 ; <i64> [#uses=1]
  119. %tmp45 = getelementptr float, float* %nrgReducePeakrate, i64 %tmp44 ; <float*> [#uses=1]
  120. store float %tmp43, float* %tmp45, align 4
  121. %tmp46 = add i32 %part.016, 1 ; <i32> [#uses=2]
  122. br label %bb8
  123. bb8: ; preds = %bb7
  124. %tmp47 = icmp slt i32 %tmp46, %bandEdgeIndex ; <i1> [#uses=1]
  125. br i1 %tmp47, label %bb, label %bb8.return_crit_edge
  126. bb8.return_crit_edge: ; preds = %bb8
  127. br label %return
  128. return: ; preds = %bb8.return_crit_edge, %entry
  129. ret void
  130. }