Home | History | Annotate | Download | only in LoopIdiom
      1 ; RUN: opt -S -indvars -loop-idiom < %s
      2 ; PR14214
      3 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
      4 target triple = "x86_64-unknown-linux-gnu"
      5 
      6 define i32 @quote_arg() nounwind {
      7 entry:
      8   br label %for.cond
      9 
     10 for.cond:                                         ; preds = %for.inc, %entry
     11   %backslashes.0 = phi i32 [ undef, %entry ], [ %backslashes.2, %for.inc ]
     12   %p.0 = phi i8* [ undef, %entry ], [ %incdec.ptr3, %for.inc ]
     13   %q.0 = phi i8* [ undef, %entry ], [ %q.2, %for.inc ]
     14   %0 = load i8* %p.0, align 1
     15   switch i8 %0, label %while.cond.preheader [
     16     i8 0, label %for.cond4.preheader
     17     i8 92, label %for.inc
     18   ]
     19 
     20 while.cond.preheader:                             ; preds = %for.cond
     21   %tobool210 = icmp eq i32 %backslashes.0, 0
     22   br i1 %tobool210, label %for.inc.loopexit, label %while.body.lr.ph
     23 
     24 while.body.lr.ph:                                 ; preds = %while.cond.preheader
     25   %1 = add i32 %backslashes.0, -1
     26   %2 = zext i32 %1 to i64
     27   br label %while.body
     28 
     29 for.cond4.preheader:                              ; preds = %for.cond
     30   %tobool57 = icmp eq i32 %backslashes.0, 0
     31   br i1 %tobool57, label %for.end10, label %for.body6.lr.ph
     32 
     33 for.body6.lr.ph:                                  ; preds = %for.cond4.preheader
     34   br label %for.body6
     35 
     36 while.body:                                       ; preds = %while.body.lr.ph, %while.body
     37   %q.112 = phi i8* [ %q.0, %while.body.lr.ph ], [ %incdec.ptr, %while.body ]
     38   %backslashes.111 = phi i32 [ %backslashes.0, %while.body.lr.ph ], [ %dec, %while.body ]
     39   %incdec.ptr = getelementptr inbounds i8* %q.112, i64 1
     40   store i8 92, i8* %incdec.ptr, align 1
     41   %dec = add nsw i32 %backslashes.111, -1
     42   %tobool2 = icmp eq i32 %dec, 0
     43   br i1 %tobool2, label %while.cond.for.inc.loopexit_crit_edge, label %while.body
     44 
     45 while.cond.for.inc.loopexit_crit_edge:            ; preds = %while.body
     46   %scevgep.sum = add i64 %2, 1
     47   %scevgep13 = getelementptr i8* %q.0, i64 %scevgep.sum
     48   br label %for.inc.loopexit
     49 
     50 for.inc.loopexit:                                 ; preds = %while.cond.for.inc.loopexit_crit_edge, %while.cond.preheader
     51   %q.1.lcssa = phi i8* [ %scevgep13, %while.cond.for.inc.loopexit_crit_edge ], [ %q.0, %while.cond.preheader ]
     52   br label %for.inc
     53 
     54 for.inc:                                          ; preds = %for.inc.loopexit, %for.cond
     55   %backslashes.2 = phi i32 [ %backslashes.0, %for.cond ], [ 0, %for.inc.loopexit ]
     56   %q.2 = phi i8* [ %q.0, %for.cond ], [ %q.1.lcssa, %for.inc.loopexit ]
     57   %incdec.ptr3 = getelementptr inbounds i8* %p.0, i64 1
     58   br label %for.cond
     59 
     60 for.body6:                                        ; preds = %for.body6.lr.ph, %for.body6
     61   %q.39 = phi i8* [ %q.0, %for.body6.lr.ph ], [ %incdec.ptr7, %for.body6 ]
     62   %backslashes.38 = phi i32 [ %backslashes.0, %for.body6.lr.ph ], [ %dec9, %for.body6 ]
     63   %incdec.ptr7 = getelementptr inbounds i8* %q.39, i64 1
     64   store i8 92, i8* %incdec.ptr7, align 1
     65   %dec9 = add nsw i32 %backslashes.38, -1
     66   %tobool5 = icmp eq i32 %dec9, 0
     67   br i1 %tobool5, label %for.cond4.for.end10_crit_edge, label %for.body6
     68 
     69 for.cond4.for.end10_crit_edge:                    ; preds = %for.body6
     70   br label %for.end10
     71 
     72 for.end10:                                        ; preds = %for.cond4.for.end10_crit_edge, %for.cond4.preheader
     73   ret i32 undef
     74 }
     75