Home | History | Annotate | Download | only in ScalarEvolution
      1 ; RUN: opt < %s -S -indvars -loop-unroll | FileCheck %s
      2 ;
      3 ; PR15570: SEGV: SCEV back-edge info invalid after dead code removal.
      4 ;
      5 ; Indvars creates a SCEV expression for the loop's back edge taken
      6 ; count, then determines that the comparison is always true and
      7 ; removes it.
      8 ;
      9 ; When loop-unroll asks for the expression, it contains a NULL
     10 ; SCEVUnknkown (as a CallbackVH).
     11 ;
     12 ; forgetMemoizedResults should invalidate the backedge taken count expression.
     13 
     14 ; CHECK: @test
     15 ; CHECK-NOT: phi
     16 ; CHECK-NOT: icmp
     17 ; CHECK: ret void
     18 define void @test() {
     19 entry:
     20   %xor1 = xor i32 0, 1
     21   br label %b17
     22 
     23 b17:
     24   br i1 undef, label %b22, label %b18
     25 
     26 b18:
     27   %phi1 = phi i32 [ %add1, %b18 ], [ %xor1, %b17 ]
     28   %add1 = add nsw i32 %phi1, -1
     29   %cmp1 = icmp sgt i32 %add1, 0
     30   br i1 %cmp1, label %b18, label %b22
     31 
     32 b22:
     33   ret void
     34 }
     35