Home | History | Annotate | Download | only in Delinearization
      1 ; RUN: opt < %s -basicaa -da -analyze -delinearize
      2 ;
      3 ; a, b, c, d, g, h;
      4 ; char *f;
      5 ; static fn1(p1) {
      6 ;   char *e = p1;
      7 ;   for (; d;) {
      8 ;     a = 0;
      9 ;     for (;; ++a)
     10 ;       for (; b; ++b)
     11 ;         c = e[b + a];
     12 ;   }
     13 ; }
     14 ;
     15 ; fn2() {
     16 ;   for (;;)
     17 ;     fn1(&f[g * h]);
     18 ; }
     19 
     20 @g = common global i32 0, align 4
     21 @h = common global i32 0, align 4
     22 @f = common global i8* null, align 4
     23 @a = common global i32 0, align 4
     24 @b = common global i32 0, align 4
     25 @c = common global i32 0, align 4
     26 @d = common global i32 0, align 4
     27 
     28 define i32 @fn2() {
     29 entry:
     30   %.pr = load i32, i32* @d, align 4
     31   %phitmp = icmp eq i32 %.pr, 0
     32   br label %for.cond
     33 
     34 for.cond:
     35   %0 = phi i1 [ true, %for.cond ], [ %phitmp, %entry ]
     36   br i1 %0, label %for.cond, label %for.cond2thread-pre-split.preheader.i
     37 
     38 for.cond2thread-pre-split.preheader.i:
     39   %1 = load i32, i32* @g, align 4
     40   %2 = load i32, i32* @h, align 4
     41   %mul = mul nsw i32 %2, %1
     42   %3 = load i8*, i8** @f, align 4
     43   %.pr.pre.i = load i32, i32* @b, align 4
     44   br label %for.cond2thread-pre-split.i
     45 
     46 for.cond2thread-pre-split.i:
     47   %.pr.i = phi i32 [ 0, %for.inc5.i ], [ %.pr.pre.i, %for.cond2thread-pre-split.preheader.i ]
     48   %storemerge.i = phi i32 [ %inc6.i, %for.inc5.i ], [ 0, %for.cond2thread-pre-split.preheader.i ]
     49   store i32 %storemerge.i, i32* @a, align 4
     50   %tobool31.i = icmp eq i32 %.pr.i, 0
     51   br i1 %tobool31.i, label %for.inc5.i, label %for.body4.preheader.i
     52 
     53 for.body4.preheader.i:
     54   %4 = icmp slt i32 %.pr.i, -7
     55   %add.i = add i32 %storemerge.i, %mul
     56   br i1 %4, label %for.body4.i.preheader, label %for.body4.ur.i.preheader
     57 
     58 for.body4.i.preheader:
     59   %5 = sub i32 -8, %.pr.i
     60   %6 = lshr i32 %5, 3
     61   %7 = mul i32 %6, 8
     62   br label %for.body4.i
     63 
     64 for.body4.i:
     65   %8 = phi i32 [ %inc.7.i, %for.body4.i ], [ %.pr.i, %for.body4.i.preheader ]
     66   %arrayidx.sum1 = add i32 %add.i, %8
     67   %arrayidx.i = getelementptr inbounds i8, i8* %3, i32 %arrayidx.sum1
     68   %9 = load i8, i8* %arrayidx.i, align 1
     69   %conv.i = sext i8 %9 to i32
     70   store i32 %conv.i, i32* @c, align 4
     71   %inc.i = add nsw i32 %8, 1
     72   store i32 %inc.i, i32* @b, align 4
     73   %arrayidx.sum2 = add i32 %add.i, %inc.i
     74   %arrayidx.1.i = getelementptr inbounds i8, i8* %3, i32 %arrayidx.sum2
     75   %10 = load i8, i8* %arrayidx.1.i, align 1
     76   %conv.1.i = sext i8 %10 to i32
     77   store i32 %conv.1.i, i32* @c, align 4
     78   %inc.1.i = add nsw i32 %8, 2
     79   store i32 %inc.1.i, i32* @b, align 4
     80   %arrayidx.sum3 = add i32 %add.i, %inc.1.i
     81   %arrayidx.2.i = getelementptr inbounds i8, i8* %3, i32 %arrayidx.sum3
     82   %11 = load i8, i8* %arrayidx.2.i, align 1
     83   %conv.2.i = sext i8 %11 to i32
     84   store i32 %conv.2.i, i32* @c, align 4
     85   %inc.2.i = add nsw i32 %8, 3
     86   store i32 %inc.2.i, i32* @b, align 4
     87   %arrayidx.sum4 = add i32 %add.i, %inc.2.i
     88   %arrayidx.3.i = getelementptr inbounds i8, i8* %3, i32 %arrayidx.sum4
     89   %12 = load i8, i8* %arrayidx.3.i, align 1
     90   %conv.3.i = sext i8 %12 to i32
     91   store i32 %conv.3.i, i32* @c, align 4
     92   %inc.3.i = add nsw i32 %8, 4
     93   store i32 %inc.3.i, i32* @b, align 4
     94   %arrayidx.sum5 = add i32 %add.i, %inc.3.i
     95   %arrayidx.4.i = getelementptr inbounds i8, i8* %3, i32 %arrayidx.sum5
     96   %13 = load i8, i8* %arrayidx.4.i, align 1
     97   %conv.4.i = sext i8 %13 to i32
     98   store i32 %conv.4.i, i32* @c, align 4
     99   %inc.4.i = add nsw i32 %8, 5
    100   store i32 %inc.4.i, i32* @b, align 4
    101   %arrayidx.sum6 = add i32 %add.i, %inc.4.i
    102   %arrayidx.5.i = getelementptr inbounds i8, i8* %3, i32 %arrayidx.sum6
    103   %14 = load i8, i8* %arrayidx.5.i, align 1
    104   %conv.5.i = sext i8 %14 to i32
    105   store i32 %conv.5.i, i32* @c, align 4
    106   %inc.5.i = add nsw i32 %8, 6
    107   store i32 %inc.5.i, i32* @b, align 4
    108   %arrayidx.sum7 = add i32 %add.i, %inc.5.i
    109   %arrayidx.6.i = getelementptr inbounds i8, i8* %3, i32 %arrayidx.sum7
    110   %15 = load i8, i8* %arrayidx.6.i, align 1
    111   %conv.6.i = sext i8 %15 to i32
    112   store i32 %conv.6.i, i32* @c, align 4
    113   %inc.6.i = add nsw i32 %8, 7
    114   store i32 %inc.6.i, i32* @b, align 4
    115   %arrayidx.sum8 = add i32 %add.i, %inc.6.i
    116   %arrayidx.7.i = getelementptr inbounds i8, i8* %3, i32 %arrayidx.sum8
    117   %16 = load i8, i8* %arrayidx.7.i, align 1
    118   %conv.7.i = sext i8 %16 to i32
    119   store i32 %conv.7.i, i32* @c, align 4
    120   %inc.7.i = add nsw i32 %8, 8
    121   store i32 %inc.7.i, i32* @b, align 4
    122   %tobool3.7.i = icmp sgt i32 %inc.7.i, -8
    123   br i1 %tobool3.7.i, label %for.inc5.loopexit.ur-lcssa.i, label %for.body4.i
    124 
    125 for.inc5.loopexit.ur-lcssa.i:
    126   %17 = add i32 %.pr.i, 8
    127   %18 = add i32 %17, %7
    128   %19 = icmp eq i32 %18, 0
    129   br i1 %19, label %for.inc5.i, label %for.body4.ur.i.preheader
    130 
    131 for.body4.ur.i.preheader:
    132   %.ph = phi i32 [ %18, %for.inc5.loopexit.ur-lcssa.i ], [ %.pr.i, %for.body4.preheader.i ]
    133   br label %for.body4.ur.i
    134 
    135 for.body4.ur.i:
    136   %20 = phi i32 [ %inc.ur.i, %for.body4.ur.i ], [ %.ph, %for.body4.ur.i.preheader ]
    137   %arrayidx.sum = add i32 %add.i, %20
    138   %arrayidx.ur.i = getelementptr inbounds i8, i8* %3, i32 %arrayidx.sum
    139   %21 = load i8, i8* %arrayidx.ur.i, align 1
    140   %conv.ur.i = sext i8 %21 to i32
    141   store i32 %conv.ur.i, i32* @c, align 4
    142   %inc.ur.i = add nsw i32 %20, 1
    143   store i32 %inc.ur.i, i32* @b, align 4
    144   %tobool3.ur.i = icmp eq i32 %inc.ur.i, 0
    145   br i1 %tobool3.ur.i, label %for.inc5.i.loopexit, label %for.body4.ur.i
    146 
    147 for.inc5.i.loopexit:
    148   br label %for.inc5.i
    149 
    150 for.inc5.i:
    151   %inc6.i = add nsw i32 %storemerge.i, 1
    152   br label %for.cond2thread-pre-split.i
    153 }
    154