multidim_only_ivs_2d_nested.ll 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. ; RUN: opt < %s -analyze -delinearize | FileCheck %s
  2. ; XFAIL: *
  3. ; We do not recognize anymore variable size arrays.
  4. ; extern void bar(long n, long m, double A[n][m]);
  5. ;
  6. ; void foo(long a, long b) {
  7. ; for (long n = 1; n < a; ++n)
  8. ; for (long m = 1; m < b; ++m) {
  9. ; double A[n][m];
  10. ; for (long i = 0; i < n; i++)
  11. ; for (long j = 0; j < m; j++)
  12. ; A[i][j] = 1.0;
  13. ; bar(n, m, A);
  14. ; }
  15. ; }
  16. ; AddRec: {{%vla.us,+,{8,+,8}<%for.cond7.preheader.lr.ph.split.us.us>}<%for.body9.lr.ph.us.us>,+,8}<%for.body9.us.us>
  17. ; CHECK: Base offset: %vla.us
  18. ; CHECK: ArrayDecl[UnknownSize][{1,+,1}<%for.cond7.preheader.lr.ph.split.us.us>] with elements of sizeof(double) bytes.
  19. ; CHECK: ArrayRef[{0,+,1}<nuw><nsw><%for.body9.lr.ph.us.us>][{0,+,1}<nuw><nsw><%for.body9.us.us>]
  20. define void @foo(i64 %a, i64 %b) nounwind uwtable {
  21. entry:
  22. %cmp43 = icmp sgt i64 %a, 1
  23. br i1 %cmp43, label %for.cond1.preheader.lr.ph, label %for.end19
  24. for.cond1.preheader.lr.ph: ; preds = %entry
  25. %cmp224 = icmp sgt i64 %b, 1
  26. br label %for.cond1.preheader
  27. for.cond1.preheader: ; preds = %for.inc17, %for.cond1.preheader.lr.ph
  28. %indvars.iv51 = phi i64 [ 1, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next52, %for.inc17 ]
  29. br i1 %cmp224, label %for.cond7.preheader.lr.ph.split.us.us, label %for.inc17
  30. for.end13.us: ; preds = %for.inc11.us.us
  31. call void @bar(i64 %indvars.iv51, i64 %indvars.iv48, double* %vla.us) nounwind
  32. call void @llvm.stackrestore(i8* %1)
  33. %indvars.iv.next49 = add i64 %indvars.iv48, 1
  34. %exitcond54 = icmp eq i64 %indvars.iv.next49, %b
  35. br i1 %exitcond54, label %for.inc17, label %for.cond7.preheader.lr.ph.split.us.us
  36. for.inc11.us.us: ; preds = %for.body9.us.us
  37. %inc12.us.us = add nsw i64 %i.023.us.us, 1
  38. %exitcond53 = icmp eq i64 %inc12.us.us, %indvars.iv51
  39. br i1 %exitcond53, label %for.end13.us, label %for.body9.lr.ph.us.us
  40. for.body9.lr.ph.us.us: ; preds = %for.cond7.preheader.lr.ph.split.us.us, %for.inc11.us.us
  41. %i.023.us.us = phi i64 [ 0, %for.cond7.preheader.lr.ph.split.us.us ], [ %inc12.us.us, %for.inc11.us.us ]
  42. %0 = mul nsw i64 %i.023.us.us, %indvars.iv48
  43. br label %for.body9.us.us
  44. for.body9.us.us: ; preds = %for.body9.us.us, %for.body9.lr.ph.us.us
  45. %j.021.us.us = phi i64 [ 0, %for.body9.lr.ph.us.us ], [ %inc.us.us, %for.body9.us.us ]
  46. %arrayidx.sum.us.us = add i64 %j.021.us.us, %0
  47. %arrayidx10.us.us = getelementptr inbounds double, double* %vla.us, i64 %arrayidx.sum.us.us
  48. store double 1.000000e+00, double* %arrayidx10.us.us, align 8
  49. %inc.us.us = add nsw i64 %j.021.us.us, 1
  50. %exitcond50 = icmp eq i64 %inc.us.us, %indvars.iv48
  51. br i1 %exitcond50, label %for.inc11.us.us, label %for.body9.us.us
  52. for.cond7.preheader.lr.ph.split.us.us: ; preds = %for.cond1.preheader, %for.end13.us
  53. %indvars.iv48 = phi i64 [ %indvars.iv.next49, %for.end13.us ], [ 1, %for.cond1.preheader ]
  54. %1 = call i8* @llvm.stacksave()
  55. %2 = mul nuw i64 %indvars.iv48, %indvars.iv51
  56. %vla.us = alloca double, i64 %2, align 16
  57. br label %for.body9.lr.ph.us.us
  58. for.inc17: ; preds = %for.end13.us, %for.cond1.preheader
  59. %indvars.iv.next52 = add i64 %indvars.iv51, 1
  60. %exitcond55 = icmp eq i64 %indvars.iv.next52, %a
  61. br i1 %exitcond55, label %for.end19, label %for.cond1.preheader
  62. for.end19: ; preds = %for.inc17, %entry
  63. ret void
  64. }
  65. declare i8* @llvm.stacksave() nounwind
  66. declare void @bar(i64, i64, double*)
  67. declare void @llvm.stackrestore(i8*) nounwind