Home | History | Annotate | Download | only in Delinearization
      1 ; RUN: opt -delinearize -analyze < %s | FileCheck %s
      2 ;
      3 ;    void foo(float *A, long *p) {
      4 ;      for (long i = 0; i < 100; i++)
      5 ;        for (long j = 0; j < 100; j++)
      6 ;          A[i * (*p) + j] += i + j;
      7 ;    }
      8 ;
      9 ; CHECK: ArrayDecl[UnknownSize][%pval] with elements of 4 bytes.
     10 ; CHECK: ArrayRef[{0,+,1}<nuw><nsw><%bb2>][{0,+,1}<nuw><nsw><%bb4>]
     11 ;
     12 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
     13 
     14 define void @foo(float* %A, i64* %p) {
     15 bb:
     16   br label %bb2
     17 
     18 bb2:                                              ; preds = %bb16, %bb
     19   %i.0 = phi i64 [ 0, %bb ], [ %tmp17, %bb16 ]
     20   %exitcond1 = icmp ne i64 %i.0, 100
     21   br i1 %exitcond1, label %bb3, label %bb18
     22 
     23 bb3:                                              ; preds = %bb2
     24   br label %bb4
     25 
     26 bb4:                                              ; preds = %bb13, %bb3
     27   %j.0 = phi i64 [ 0, %bb3 ], [ %tmp14, %bb13 ]
     28   %exitcond = icmp ne i64 %j.0, 100
     29   br i1 %exitcond, label %bb5, label %bb15
     30 
     31 bb5:                                              ; preds = %bb4
     32   %tmp = add nuw nsw i64 %i.0, %j.0
     33   %tmp6 = sitofp i64 %tmp to float
     34   %pval = load i64, i64* %p, align 8
     35   %tmp8 = mul nsw i64 %i.0, %pval
     36   %tmp9 = add nsw i64 %tmp8, %j.0
     37   %tmp10 = getelementptr inbounds float, float* %A, i64 %tmp9
     38   %tmp11 = load float, float* %tmp10, align 4
     39   %tmp12 = fadd float %tmp11, %tmp6
     40   store float %tmp12, float* %tmp10, align 4
     41   br label %bb13
     42 
     43 bb13:                                             ; preds = %bb5
     44   %tmp14 = add nuw nsw i64 %j.0, 1
     45   br label %bb4
     46 
     47 bb15:                                             ; preds = %bb4
     48   br label %bb16
     49 
     50 bb16:                                             ; preds = %bb15
     51   %tmp17 = add nuw nsw i64 %i.0, 1
     52   br label %bb2
     53 
     54 bb18:                                             ; preds = %bb2
     55   ret void
     56 }
     57