WeakZeroSrcSIV.ll 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
  2. ; ModuleID = 'WeakZeroSrcSIV.bc'
  3. 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-n8:16:32:64-S128"
  4. target triple = "x86_64-apple-macosx10.6.0"
  5. ;; for (long unsigned i = 0; i < 30; i++) {
  6. ;; A[10] = i;
  7. ;; *B++ = A[2*i + 10];
  8. define void @weakzerosrc0(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
  9. entry:
  10. br label %for.body
  11. ; CHECK: da analyze - consistent output [S]!
  12. ; CHECK: da analyze - flow [p<=|<]!
  13. ; CHECK: da analyze - confused!
  14. ; CHECK: da analyze - none!
  15. ; CHECK: da analyze - confused!
  16. ; CHECK: da analyze - none!
  17. for.body: ; preds = %entry, %for.body
  18. %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
  19. %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
  20. %conv = trunc i64 %i.02 to i32
  21. %arrayidx = getelementptr inbounds i32, i32* %A, i64 10
  22. store i32 %conv, i32* %arrayidx, align 4
  23. %mul = shl i64 %i.02, 1
  24. %add = add i64 %mul, 10
  25. %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %add
  26. %0 = load i32, i32* %arrayidx1, align 4
  27. %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
  28. store i32 %0, i32* %B.addr.01, align 4
  29. %inc = add i64 %i.02, 1
  30. %exitcond = icmp ne i64 %inc, 30
  31. br i1 %exitcond, label %for.body, label %for.end
  32. for.end: ; preds = %for.body
  33. ret void
  34. }
  35. ;; for (long unsigned i = 0; i < n; i++) {
  36. ;; A[10] = i;
  37. ;; *B++ = A[n*i + 10];
  38. define void @weakzerosrc1(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
  39. entry:
  40. %cmp1 = icmp eq i64 %n, 0
  41. br i1 %cmp1, label %for.end, label %for.body.preheader
  42. ; CHECK: da analyze - consistent output [S]!
  43. ; CHECK: da analyze - flow [p<=|<]!
  44. ; CHECK: da analyze - confused!
  45. ; CHECK: da analyze - none!
  46. ; CHECK: da analyze - confused!
  47. ; CHECK: da analyze - none!
  48. for.body.preheader: ; preds = %entry
  49. br label %for.body
  50. for.body: ; preds = %for.body.preheader, %for.body
  51. %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
  52. %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
  53. %conv = trunc i64 %i.03 to i32
  54. %arrayidx = getelementptr inbounds i32, i32* %A, i64 10
  55. store i32 %conv, i32* %arrayidx, align 4
  56. %mul = mul i64 %i.03, %n
  57. %add = add i64 %mul, 10
  58. %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %add
  59. %0 = load i32, i32* %arrayidx1, align 4
  60. %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
  61. store i32 %0, i32* %B.addr.02, align 4
  62. %inc = add i64 %i.03, 1
  63. %exitcond = icmp ne i64 %inc, %n
  64. br i1 %exitcond, label %for.body, label %for.end.loopexit
  65. for.end.loopexit: ; preds = %for.body
  66. br label %for.end
  67. for.end: ; preds = %for.end.loopexit, %entry
  68. ret void
  69. }
  70. ;; for (long unsigned i = 0; i < 5; i++) {
  71. ;; A[10] = i;
  72. ;; *B++ = A[2*i];
  73. define void @weakzerosrc2(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
  74. entry:
  75. br label %for.body
  76. ; CHECK: da analyze - consistent output [S]!
  77. ; CHECK: da analyze - none!
  78. ; CHECK: da analyze - confused!
  79. ; CHECK: da analyze - none!
  80. ; CHECK: da analyze - confused!
  81. ; CHECK: da analyze - none!
  82. for.body: ; preds = %entry, %for.body
  83. %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
  84. %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
  85. %conv = trunc i64 %i.02 to i32
  86. %arrayidx = getelementptr inbounds i32, i32* %A, i64 10
  87. store i32 %conv, i32* %arrayidx, align 4
  88. %mul = shl i64 %i.02, 1
  89. %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %mul
  90. %0 = load i32, i32* %arrayidx1, align 4
  91. %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
  92. store i32 %0, i32* %B.addr.01, align 4
  93. %inc = add i64 %i.02, 1
  94. %exitcond = icmp ne i64 %inc, 5
  95. br i1 %exitcond, label %for.body, label %for.end
  96. for.end: ; preds = %for.body
  97. ret void
  98. }
  99. ;; for (long unsigned i = 0; i < 6; i++) {
  100. ;; A[10] = i;
  101. ;; *B++ = A[2*i];
  102. define void @weakzerosrc3(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
  103. entry:
  104. br label %for.body
  105. ; CHECK: da analyze - consistent output [S]!
  106. ; CHECK: da analyze - flow [=>p|<]!
  107. ; CHECK: da analyze - confused!
  108. ; CHECK: da analyze - none!
  109. ; CHECK: da analyze - confused!
  110. ; CHECK: da analyze - none!
  111. for.body: ; preds = %entry, %for.body
  112. %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
  113. %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
  114. %conv = trunc i64 %i.02 to i32
  115. %arrayidx = getelementptr inbounds i32, i32* %A, i64 10
  116. store i32 %conv, i32* %arrayidx, align 4
  117. %mul = shl i64 %i.02, 1
  118. %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %mul
  119. %0 = load i32, i32* %arrayidx1, align 4
  120. %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
  121. store i32 %0, i32* %B.addr.01, align 4
  122. %inc = add i64 %i.02, 1
  123. %exitcond = icmp ne i64 %inc, 6
  124. br i1 %exitcond, label %for.body, label %for.end
  125. for.end: ; preds = %for.body
  126. ret void
  127. }
  128. ;; for (long unsigned i = 0; i < 7; i++) {
  129. ;; A[10] = i;
  130. ;; *B++ = A[2*i];
  131. define void @weakzerosrc4(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
  132. entry:
  133. br label %for.body
  134. ; CHECK: da analyze - consistent output [S]!
  135. ; CHECK: da analyze - flow [*|<]!
  136. ; CHECK: da analyze - confused!
  137. ; CHECK: da analyze - none!
  138. ; CHECK: da analyze - confused!
  139. ; CHECK: da analyze - none!
  140. for.body: ; preds = %entry, %for.body
  141. %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
  142. %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
  143. %conv = trunc i64 %i.02 to i32
  144. %arrayidx = getelementptr inbounds i32, i32* %A, i64 10
  145. store i32 %conv, i32* %arrayidx, align 4
  146. %mul = shl i64 %i.02, 1
  147. %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %mul
  148. %0 = load i32, i32* %arrayidx1, align 4
  149. %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
  150. store i32 %0, i32* %B.addr.01, align 4
  151. %inc = add i64 %i.02, 1
  152. %exitcond = icmp ne i64 %inc, 7
  153. br i1 %exitcond, label %for.body, label %for.end
  154. for.end: ; preds = %for.body
  155. ret void
  156. }
  157. ;; for (long unsigned i = 0; i < 7; i++) {
  158. ;; A[-10] = i;
  159. ;; *B++ = A[2*i];
  160. define void @weakzerosrc5(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
  161. entry:
  162. br label %for.body
  163. ; CHECK: da analyze - consistent output [S]!
  164. ; CHECK: da analyze - none!
  165. ; CHECK: da analyze - confused!
  166. ; CHECK: da analyze - none!
  167. ; CHECK: da analyze - confused!
  168. ; CHECK: da analyze - none!
  169. for.body: ; preds = %entry, %for.body
  170. %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
  171. %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
  172. %conv = trunc i64 %i.02 to i32
  173. %arrayidx = getelementptr inbounds i32, i32* %A, i64 -10
  174. store i32 %conv, i32* %arrayidx, align 4
  175. %mul = shl i64 %i.02, 1
  176. %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %mul
  177. %0 = load i32, i32* %arrayidx1, align 4
  178. %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
  179. store i32 %0, i32* %B.addr.01, align 4
  180. %inc = add i64 %i.02, 1
  181. %exitcond = icmp ne i64 %inc, 7
  182. br i1 %exitcond, label %for.body, label %for.end
  183. for.end: ; preds = %for.body
  184. ret void
  185. }
  186. ;; for (long unsigned i = 0; i < n; i++) {
  187. ;; A[10] = i;
  188. ;; *B++ = A[3*i];
  189. define void @weakzerosrc6(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
  190. entry:
  191. %cmp1 = icmp eq i64 %n, 0
  192. br i1 %cmp1, label %for.end, label %for.body.preheader
  193. ; CHECK: da analyze - consistent output [S]!
  194. ; CHECK: da analyze - none!
  195. ; CHECK: da analyze - confused!
  196. ; CHECK: da analyze - none!
  197. ; CHECK: da analyze - confused!
  198. ; CHECK: da analyze - none!
  199. for.body.preheader: ; preds = %entry
  200. br label %for.body
  201. for.body: ; preds = %for.body.preheader, %for.body
  202. %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
  203. %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
  204. %conv = trunc i64 %i.03 to i32
  205. %arrayidx = getelementptr inbounds i32, i32* %A, i64 10
  206. store i32 %conv, i32* %arrayidx, align 4
  207. %mul = mul i64 %i.03, 3
  208. %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %mul
  209. %0 = load i32, i32* %arrayidx1, align 4
  210. %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
  211. store i32 %0, i32* %B.addr.02, align 4
  212. %inc = add i64 %i.03, 1
  213. %exitcond = icmp ne i64 %inc, %n
  214. br i1 %exitcond, label %for.body, label %for.end.loopexit
  215. for.end.loopexit: ; preds = %for.body
  216. br label %for.end
  217. for.end: ; preds = %for.end.loopexit, %entry
  218. ret void
  219. }