Home | History | Annotate | Download | only in DependenceAnalysis
      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 
      6 ;; struct s {
      7 ;;   int A[10][10];
      8 ;;   int C[10][10][10]; 
      9 ;; } S;
     10 
     11 ;; void dep_constraint_crash_test(int k,int N) {
     12 ;;   for( int i=0;i<N;i++)
     13 ;;     for( int j=0;j<N;j++)
     14 ;;       S.A[0][0] = S.C[0][0][k];
     15 ;; }
     16 
     17 
     18 %struct.s = type { [10 x [10 x i32]], [10 x [10 x [10 x i32]]] }
     19 
     20 @S = common global %struct.s zeroinitializer
     21 
     22 define void @dep_constraint_crash_test(i32 %k, i32 %N) {
     23 entry:
     24   %cmp12 = icmp sgt i32 %N, 0
     25   br i1 %cmp12, label %for.cond1.preheader.lr.ph, label %for.end6
     26 
     27 for.cond1.preheader.lr.ph:                        
     28   %idxprom = sext i32 %k to i64
     29   %arrayidx = getelementptr inbounds %struct.s, %struct.s* @S, i64 0, i32 1, i64 0, i64 0, i64 %idxprom
     30   br label %for.body3.preheader
     31 
     32 for.body3.preheader:                              
     33   %i.013 = phi i32 [ 0, %for.cond1.preheader.lr.ph ], [ %inc5, %for.inc4 ]
     34   br label %for.body3
     35 
     36 for.body3:                                        
     37   %j.011 = phi i32 [ %inc, %for.body3 ], [ 0, %for.body3.preheader ]
     38   %0 = load i32, i32* %arrayidx
     39   store i32 %0, i32* getelementptr inbounds (%struct.s, %struct.s* @S, i64 0, i32 0, i64 0, i64 0)
     40   %inc = add nuw nsw i32 %j.011, 1
     41   %exitcond = icmp eq i32 %inc, %N
     42   br i1 %exitcond, label %for.inc4, label %for.body3
     43 
     44 for.inc4:                                         
     45   %inc5 = add nuw nsw i32 %i.013, 1
     46   %exitcond14 = icmp eq i32 %inc5, %N
     47   br i1 %exitcond14, label %for.end6, label %for.body3.preheader
     48 
     49 for.end6:                                         
     50   ret void
     51 }
     52