UsefulGEP.ll 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ; RUN: opt < %s -analyze -basicaa -da
  2. ;; Check this doesn't crash.
  3. target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
  4. target triple = "x86_64-unknown-linux-gnu"
  5. ;; struct s {
  6. ;; int A[10][10];
  7. ;; int C[10][10][10];
  8. ;; } S;
  9. ;; void dep_constraint_crash_test(int k,int N) {
  10. ;; for( int i=0;i<N;i++)
  11. ;; for( int j=0;j<N;j++)
  12. ;; S.A[0][0] = S.C[0][0][k];
  13. ;; }
  14. %struct.s = type { [10 x [10 x i32]], [10 x [10 x [10 x i32]]] }
  15. @S = common global %struct.s zeroinitializer
  16. define void @dep_constraint_crash_test(i32 %k, i32 %N) {
  17. entry:
  18. %cmp12 = icmp sgt i32 %N, 0
  19. br i1 %cmp12, label %for.cond1.preheader.lr.ph, label %for.end6
  20. for.cond1.preheader.lr.ph:
  21. %idxprom = sext i32 %k to i64
  22. %arrayidx = getelementptr inbounds %struct.s, %struct.s* @S, i64 0, i32 1, i64 0, i64 0, i64 %idxprom
  23. br label %for.body3.preheader
  24. for.body3.preheader:
  25. %i.013 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %inc5, %for.inc4 ]
  26. br label %for.body3
  27. for.body3:
  28. %j.011 = phi i32 [ %inc, %for.body3 ], [ 0, %for.body3.preheader ]
  29. %0 = load i32, i32* %arrayidx
  30. store i32 %0, i32* getelementptr inbounds (%struct.s, %struct.s* @S, i64 0, i32 0, i64 0, i64 0)
  31. %inc = add nuw nsw i32 %j.011, 1
  32. %exitcond = icmp eq i32 %inc, %N
  33. br i1 %exitcond, label %for.inc4, label %for.body3
  34. for.inc4:
  35. %inc5 = add nuw nsw i32 %i.013, 1
  36. %exitcond14 = icmp eq i32 %inc5, %N
  37. br i1 %exitcond14, label %for.end6, label %for.body3.preheader
  38. for.end6:
  39. ret void
  40. }