basic.ll 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ; RUN: opt < %s -loop-unroll -S | FileCheck %s
  2. ; This should not unroll since the address of the loop header is taken.
  3. ; CHECK-LABEL: @test1(
  4. ; CHECK: store i8* blockaddress(@test1, %l1), i8** %P
  5. ; CHECK: l1:
  6. ; CHECK-NEXT: phi i32
  7. ; rdar://8287027
  8. define i32 @test1(i8** %P) nounwind ssp {
  9. entry:
  10. store i8* blockaddress(@test1, %l1), i8** %P
  11. br label %l1
  12. l1: ; preds = %l1, %entry
  13. %x.0 = phi i32 [ 0, %entry ], [ %inc, %l1 ]
  14. %inc = add nsw i32 %x.0, 1
  15. %exitcond = icmp eq i32 %inc, 3
  16. br i1 %exitcond, label %l2, label %l1
  17. l2: ; preds = %l1
  18. ret i32 0
  19. }
  20. ; This should not unroll since the call is 'noduplicate'.
  21. ; CHECK-LABEL: @test2(
  22. define i32 @test2(i8** %P) nounwind ssp {
  23. entry:
  24. br label %l1
  25. l1: ; preds = %l1, %entry
  26. %x.0 = phi i32 [ 0, %entry ], [ %inc, %l1 ]
  27. ; CHECK: call void @f()
  28. ; CHECK-NOT: call void @f()
  29. call void @f() noduplicate
  30. %inc = add nsw i32 %x.0, 1
  31. %exitcond = icmp eq i32 %inc, 3
  32. br i1 %exitcond, label %l2, label %l1
  33. l2: ; preds = %l1
  34. ret i32 0
  35. ; CHECK: }
  36. }
  37. declare void @f()