scev-invalid.ll 814 B

12345678910111213141516171819202122232425262728293031323334
  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. ; CHECK: @test
  14. ; CHECK-NOT: phi
  15. ; CHECK-NOT: icmp
  16. ; CHECK: ret void
  17. define void @test() {
  18. entry:
  19. %xor1 = xor i32 0, 1
  20. br label %b17
  21. b17:
  22. br i1 undef, label %b22, label %b18
  23. b18:
  24. %phi1 = phi i32 [ %add1, %b18 ], [ %xor1, %b17 ]
  25. %add1 = add nsw i32 %phi1, -1
  26. %cmp1 = icmp sgt i32 %add1, 0
  27. br i1 %cmp1, label %b18, label %b22
  28. b22:
  29. ret void
  30. }