Home | History | Annotate | Download | only in ScalarEvolution
      1 ; RUN: opt < %s -iv-users -S -disable-output
      2 ;
      3 ; PR12868: Infinite recursion:
      4 ; getUDivExpr()->getZeroExtendExpr()->isLoopBackedgeGuardedBy()
      5 ;
      6 ; We actually want SCEV simplification to fail gracefully in this
      7 ; case, so there's no output to check, just the absence of stack overflow.
      8 
      9 @c = common global i8 0, align 1
     10 
     11 define i32 @func() {
     12 entry:
     13   br label %for.cond
     14 
     15 for.cond:                                         ; preds = %for.body, %entry
     16   %storemerge = phi i8 [ -1, %entry ], [ %inc, %for.body ]
     17   %ui.0 = phi i32 [ undef, %entry ], [ %div, %for.body ]
     18   %tobool = icmp eq i8 %storemerge, 0
     19   br i1 %tobool, label %for.end, label %for.body
     20 
     21 for.body:                                         ; preds = %for.cond
     22   %conv = sext i8 %storemerge to i32
     23   %div = lshr i32 %conv, 1
     24   %tobool2 = icmp eq i32 %div, 0
     25   %inc = add i8 %storemerge, 1
     26   br i1 %tobool2, label %for.cond, label %for.end
     27 
     28 for.end:                                          ; preds = %for.body, %for.cond
     29   ret i32 0
     30 }
     31