Home | History | Annotate | Download | only in IndVarSimplify
      1 ; RUN: opt -indvars -S < %s | FileCheck %s
      2 
      3 
      4 ; Ensure that does not crash
      5 
      6 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
      7 target triple = "x86_64-unknown-linux-gnu"
      8 
      9 define void @f() {
     10 ; CHECK-LABEL: @f(
     11 entry:
     12   br label %for.end
     13 
     14 for.condt:                         ; preds = %for.end
     15   br i1 true, label %for.cond.0, label %for.end
     16 
     17 for.end:                                          ; preds = %for.body.3
     18   %inc = select i1 undef, i32 2, i32 1
     19   br i1 false, label %for.condt, label %for.cond.0
     20 
     21 for.cond.0:                       ; preds = %for.end, %for.condt
     22   %init = phi i32 [ 0, %for.condt ], [ %inc, %for.end ]
     23   br i1 true, label %for.end.13, label %for.body.9
     24 
     25 for.body.9:                                       ; preds = %for.body.9, %for.cond.0
     26   %p1.addr.22 = phi i32 [ %inc10, %for.body.9 ], [ %init, %for.cond.0 ]
     27   %inc10 = add i32 %p1.addr.22, 1
     28   br i1 true, label %for.end.13, label %for.body.9
     29 
     30 for.end.13:                                       ; preds = %for.cond.7.for.end.13_crit_edge, %for.cond.0
     31   %p1.addr.2.lcssa = phi i32 [ %inc10, %for.body.9 ], [ %init, %for.cond.0 ]
     32   ret void
     33 }
     34