StrongSIV.ll 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. ; RUN: opt < %s -analyze -basicaa -da | FileCheck %s
  2. ; ModuleID = 'StrongSIV.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 (int i = 0; i < n; i++) {
  6. ;; A[i + 2] = i;
  7. ;; *B++ = A[i];
  8. define void @strong0(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
  9. entry:
  10. %cmp1 = icmp sgt i64 %n, 0
  11. br i1 %cmp1, label %for.body.preheader, label %for.end
  12. ; CHECK: da analyze - none!
  13. ; CHECK: da analyze - consistent flow [2]!
  14. ; CHECK: da analyze - confused!
  15. ; CHECK: da analyze - none!
  16. ; CHECK: da analyze - confused!
  17. ; CHECK: da analyze - none!
  18. for.body.preheader: ; preds = %entry
  19. br label %for.body
  20. for.body: ; preds = %for.body.preheader, %for.body
  21. %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
  22. %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
  23. %0 = add nsw i64 %indvars.iv, 2
  24. %arrayidx = getelementptr inbounds i32, i32* %A, i64 %0
  25. %1 = trunc i64 %indvars.iv to i32
  26. store i32 %1, i32* %arrayidx, align 4
  27. %arrayidx3 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
  28. %2 = load i32, i32* %arrayidx3, align 4
  29. %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
  30. store i32 %2, i32* %B.addr.02, align 4
  31. %indvars.iv.next = add i64 %indvars.iv, 1
  32. %exitcond = icmp ne i64 %indvars.iv.next, %n
  33. br i1 %exitcond, label %for.body, label %for.end.loopexit
  34. for.end.loopexit: ; preds = %for.body
  35. br label %for.end
  36. for.end: ; preds = %for.end.loopexit, %entry
  37. ret void
  38. }
  39. ;; for (long int i = 0; i < n; i++) {
  40. ;; A[i + 2] = i;
  41. ;; *B++ = A[i];
  42. define void @strong1(i32* %A, i32* %B, i32 %n) nounwind uwtable ssp {
  43. entry:
  44. %cmp1 = icmp sgt i32 %n, 0
  45. br i1 %cmp1, label %for.body.preheader, label %for.end
  46. ; CHECK: da analyze - none!
  47. ; CHECK: da analyze - consistent flow [2]!
  48. ; CHECK: da analyze - confused!
  49. ; CHECK: da analyze - none!
  50. ; CHECK: da analyze - confused!
  51. ; CHECK: da analyze - none!
  52. for.body.preheader: ; preds = %entry
  53. %0 = sext i32 %n to i64
  54. br label %for.body
  55. for.body: ; preds = %for.body.preheader, %for.body
  56. %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
  57. %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
  58. %conv2 = trunc i64 %i.03 to i32
  59. %add = add nsw i64 %i.03, 2
  60. %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
  61. store i32 %conv2, i32* %arrayidx, align 4
  62. %arrayidx3 = getelementptr inbounds i32, i32* %A, i64 %i.03
  63. %1 = load i32, i32* %arrayidx3, align 4
  64. %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
  65. store i32 %1, i32* %B.addr.02, align 4
  66. %inc = add nsw i64 %i.03, 1
  67. %exitcond = icmp ne i64 %inc, %0
  68. br i1 %exitcond, label %for.body, label %for.end.loopexit
  69. for.end.loopexit: ; preds = %for.body
  70. br label %for.end
  71. for.end: ; preds = %for.end.loopexit, %entry
  72. ret void
  73. }
  74. ;; for (long unsigned i = 0; i < n; i++) {
  75. ;; A[i + 2] = i;
  76. ;; *B++ = A[i];
  77. define void @strong2(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
  78. entry:
  79. %cmp1 = icmp eq i64 %n, 0
  80. br i1 %cmp1, label %for.end, label %for.body.preheader
  81. ; CHECK: da analyze - none!
  82. ; CHECK: da analyze - consistent flow [2]!
  83. ; CHECK: da analyze - confused!
  84. ; CHECK: da analyze - none!
  85. ; CHECK: da analyze - confused!
  86. ; CHECK: da analyze - none!
  87. for.body.preheader: ; preds = %entry
  88. br label %for.body
  89. for.body: ; preds = %for.body.preheader, %for.body
  90. %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
  91. %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
  92. %conv = trunc i64 %i.03 to i32
  93. %add = add i64 %i.03, 2
  94. %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
  95. store i32 %conv, i32* %arrayidx, align 4
  96. %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %i.03
  97. %0 = load i32, i32* %arrayidx1, align 4
  98. %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
  99. store i32 %0, i32* %B.addr.02, align 4
  100. %inc = add i64 %i.03, 1
  101. %exitcond = icmp ne i64 %inc, %n
  102. br i1 %exitcond, label %for.body, label %for.end.loopexit
  103. for.end.loopexit: ; preds = %for.body
  104. br label %for.end
  105. for.end: ; preds = %for.end.loopexit, %entry
  106. ret void
  107. }
  108. ;; for (int i = 0; i < n; i++) {
  109. ;; A[i + 2] = i;
  110. ;; *B++ = A[i];
  111. define void @strong3(i32* %A, i32* %B, i32 %n) nounwind uwtable ssp {
  112. entry:
  113. %cmp1 = icmp sgt i32 %n, 0
  114. br i1 %cmp1, label %for.body.preheader, label %for.end
  115. ; CHECK: da analyze - none!
  116. ; CHECK: da analyze - consistent flow [2]!
  117. ; CHECK: da analyze - confused!
  118. ; CHECK: da analyze - none!
  119. ; CHECK: da analyze - confused!
  120. ; CHECK: da analyze - none!
  121. for.body.preheader: ; preds = %entry
  122. br label %for.body
  123. for.body: ; preds = %for.body.preheader, %for.body
  124. %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
  125. %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
  126. %0 = add nsw i64 %indvars.iv, 2
  127. %arrayidx = getelementptr inbounds i32, i32* %A, i64 %0
  128. %1 = trunc i64 %indvars.iv to i32
  129. store i32 %1, i32* %arrayidx, align 4
  130. %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
  131. %2 = load i32, i32* %arrayidx2, align 4
  132. %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
  133. store i32 %2, i32* %B.addr.02, align 4
  134. %indvars.iv.next = add i64 %indvars.iv, 1
  135. %lftr.wideiv = trunc i64 %indvars.iv.next to i32
  136. %exitcond = icmp ne i32 %lftr.wideiv, %n
  137. br i1 %exitcond, label %for.body, label %for.end.loopexit
  138. for.end.loopexit: ; preds = %for.body
  139. br label %for.end
  140. for.end: ; preds = %for.end.loopexit, %entry
  141. ret void
  142. }
  143. ;; for (long unsigned i = 0; i < 19; i++) {
  144. ;; A[i + 19] = i;
  145. ;; *B++ = A[i];
  146. define void @strong4(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
  147. entry:
  148. br label %for.body
  149. ; CHECK: da analyze - none!
  150. ; CHECK: da analyze - none!
  151. ; CHECK: da analyze - confused!
  152. ; CHECK: da analyze - none!
  153. ; CHECK: da analyze - confused!
  154. ; CHECK: da analyze - none!
  155. for.body: ; preds = %entry, %for.body
  156. %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
  157. %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
  158. %conv = trunc i64 %i.02 to i32
  159. %add = add i64 %i.02, 19
  160. %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
  161. store i32 %conv, i32* %arrayidx, align 4
  162. %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %i.02
  163. %0 = load i32, i32* %arrayidx1, align 4
  164. %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
  165. store i32 %0, i32* %B.addr.01, align 4
  166. %inc = add i64 %i.02, 1
  167. %exitcond = icmp ne i64 %inc, 19
  168. br i1 %exitcond, label %for.body, label %for.end
  169. for.end: ; preds = %for.body
  170. ret void
  171. }
  172. ;; for (long unsigned i = 0; i < 20; i++) {
  173. ;; A[i + 19] = i;
  174. ;; *B++ = A[i];
  175. define void @strong5(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
  176. entry:
  177. br label %for.body
  178. ; CHECK: da analyze - none!
  179. ; CHECK: da analyze - consistent flow [19]!
  180. ; CHECK: da analyze - confused!
  181. ; CHECK: da analyze - none!
  182. ; CHECK: da analyze - confused!
  183. ; CHECK: da analyze - none!
  184. for.body: ; preds = %entry, %for.body
  185. %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
  186. %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
  187. %conv = trunc i64 %i.02 to i32
  188. %add = add i64 %i.02, 19
  189. %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
  190. store i32 %conv, i32* %arrayidx, align 4
  191. %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %i.02
  192. %0 = load i32, i32* %arrayidx1, align 4
  193. %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
  194. store i32 %0, i32* %B.addr.01, align 4
  195. %inc = add i64 %i.02, 1
  196. %exitcond = icmp ne i64 %inc, 20
  197. br i1 %exitcond, label %for.body, label %for.end
  198. for.end: ; preds = %for.body
  199. ret void
  200. }
  201. ;; for (long unsigned i = 0; i < 20; i++) {
  202. ;; A[2*i + 6] = i;
  203. ;; *B++ = A[2*i];
  204. define void @strong6(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
  205. entry:
  206. br label %for.body
  207. ; CHECK: da analyze - none!
  208. ; CHECK: da analyze - consistent flow [3]!
  209. ; CHECK: da analyze - confused!
  210. ; CHECK: da analyze - none!
  211. ; CHECK: da analyze - confused!
  212. ; CHECK: da analyze - none!
  213. for.body: ; preds = %entry, %for.body
  214. %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
  215. %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
  216. %conv = trunc i64 %i.02 to i32
  217. %mul = shl i64 %i.02, 1
  218. %add = add i64 %mul, 6
  219. %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
  220. store i32 %conv, i32* %arrayidx, align 4
  221. %mul1 = shl i64 %i.02, 1
  222. %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %mul1
  223. %0 = load i32, i32* %arrayidx2, align 4
  224. %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
  225. store i32 %0, i32* %B.addr.01, align 4
  226. %inc = add i64 %i.02, 1
  227. %exitcond = icmp ne i64 %inc, 20
  228. br i1 %exitcond, label %for.body, label %for.end
  229. for.end: ; preds = %for.body
  230. ret void
  231. }
  232. ;; for (long unsigned i = 0; i < 20; i++) {
  233. ;; A[2*i + 7] = i;
  234. ;; *B++ = A[2*i];
  235. define void @strong7(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
  236. entry:
  237. br label %for.body
  238. ; CHECK: da analyze - none!
  239. ; CHECK: da analyze - none!
  240. ; CHECK: da analyze - confused!
  241. ; CHECK: da analyze - none!
  242. ; CHECK: da analyze - confused!
  243. ; CHECK: da analyze - none!
  244. for.body: ; preds = %entry, %for.body
  245. %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
  246. %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
  247. %conv = trunc i64 %i.02 to i32
  248. %mul = shl i64 %i.02, 1
  249. %add = add i64 %mul, 7
  250. %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
  251. store i32 %conv, i32* %arrayidx, align 4
  252. %mul1 = shl i64 %i.02, 1
  253. %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %mul1
  254. %0 = load i32, i32* %arrayidx2, align 4
  255. %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
  256. store i32 %0, i32* %B.addr.01, align 4
  257. %inc = add i64 %i.02, 1
  258. %exitcond = icmp ne i64 %inc, 20
  259. br i1 %exitcond, label %for.body, label %for.end
  260. for.end: ; preds = %for.body
  261. ret void
  262. }
  263. ;; for (long unsigned i = 0; i < 20; i++) {
  264. ;; A[i + n] = i;
  265. ;; *B++ = A[i];
  266. define void @strong8(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
  267. entry:
  268. br label %for.body
  269. ; CHECK: da analyze - none!
  270. ; CHECK: da analyze - consistent flow [%n|<]!
  271. ; CHECK: da analyze - confused!
  272. ; CHECK: da analyze - none!
  273. ; CHECK: da analyze - confused!
  274. ; CHECK: da analyze - none!
  275. for.body: ; preds = %entry, %for.body
  276. %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
  277. %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
  278. %conv = trunc i64 %i.02 to i32
  279. %add = add i64 %i.02, %n
  280. %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
  281. store i32 %conv, i32* %arrayidx, align 4
  282. %arrayidx1 = getelementptr inbounds i32, i32* %A, i64 %i.02
  283. %0 = load i32, i32* %arrayidx1, align 4
  284. %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
  285. store i32 %0, i32* %B.addr.01, align 4
  286. %inc = add i64 %i.02, 1
  287. %exitcond = icmp ne i64 %inc, 20
  288. br i1 %exitcond, label %for.body, label %for.end
  289. for.end: ; preds = %for.body
  290. ret void
  291. }
  292. ;; for (long unsigned i = 0; i < n; i++) {
  293. ;; A[i + n] = i;
  294. ;; *B++ = A[i + 2*n];
  295. define void @strong9(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
  296. entry:
  297. %cmp1 = icmp eq i64 %n, 0
  298. br i1 %cmp1, label %for.end, label %for.body.preheader
  299. ; CHECK: da analyze - none!
  300. ; CHECK: da analyze - none!
  301. ; CHECK: da analyze - confused!
  302. ; CHECK: da analyze - none!
  303. ; CHECK: da analyze - confused!
  304. ; CHECK: da analyze - none!
  305. for.body.preheader: ; preds = %entry
  306. br label %for.body
  307. for.body: ; preds = %for.body.preheader, %for.body
  308. %i.03 = phi i64 [ %inc, %for.body ], [ 0, %for.body.preheader ]
  309. %B.addr.02 = phi i32* [ %incdec.ptr, %for.body ], [ %B, %for.body.preheader ]
  310. %conv = trunc i64 %i.03 to i32
  311. %add = add i64 %i.03, %n
  312. %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
  313. store i32 %conv, i32* %arrayidx, align 4
  314. %mul = shl i64 %n, 1
  315. %add1 = add i64 %i.03, %mul
  316. %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %add1
  317. %0 = load i32, i32* %arrayidx2, align 4
  318. %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.02, i64 1
  319. store i32 %0, i32* %B.addr.02, align 4
  320. %inc = add i64 %i.03, 1
  321. %exitcond = icmp ne i64 %inc, %n
  322. br i1 %exitcond, label %for.body, label %for.end.loopexit
  323. for.end.loopexit: ; preds = %for.body
  324. br label %for.end
  325. for.end: ; preds = %for.end.loopexit, %entry
  326. ret void
  327. }
  328. ;; for (long unsigned i = 0; i < 1000; i++) {
  329. ;; A[n*i + 5] = i;
  330. ;; *B++ = A[n*i + 5];
  331. define void @strong10(i32* %A, i32* %B, i64 %n) nounwind uwtable ssp {
  332. entry:
  333. br label %for.body
  334. ; CHECK: da analyze - none!
  335. ; CHECK: da analyze - consistent flow [0|<]!
  336. ; CHECK: da analyze - confused!
  337. ; CHECK: da analyze - none!
  338. ; CHECK: da analyze - confused!
  339. ; CHECK: da analyze - none!
  340. for.body: ; preds = %entry, %for.body
  341. %i.02 = phi i64 [ 0, %entry ], [ %inc, %for.body ]
  342. %B.addr.01 = phi i32* [ %B, %entry ], [ %incdec.ptr, %for.body ]
  343. %conv = trunc i64 %i.02 to i32
  344. %mul = mul i64 %i.02, %n
  345. %add = add i64 %mul, 5
  346. %arrayidx = getelementptr inbounds i32, i32* %A, i64 %add
  347. store i32 %conv, i32* %arrayidx, align 4
  348. %mul1 = mul i64 %i.02, %n
  349. %add2 = add i64 %mul1, 5
  350. %arrayidx3 = getelementptr inbounds i32, i32* %A, i64 %add2
  351. %0 = load i32, i32* %arrayidx3, align 4
  352. %incdec.ptr = getelementptr inbounds i32, i32* %B.addr.01, i64 1
  353. store i32 %0, i32* %B.addr.01, align 4
  354. %inc = add i64 %i.02, 1
  355. %exitcond = icmp ne i64 %inc, 1000
  356. br i1 %exitcond, label %for.body, label %for.end
  357. for.end: ; preds = %for.body
  358. ret void
  359. }