seh-nounwind.ll 814 B

12345678910111213141516171819202122232425262728293031
  1. ; RUN: opt -S -simplifycfg < %s | FileCheck %s
  2. ; Don't remove invokes of nounwind functions if the personality handles async
  3. ; exceptions. The @div function in this test can fault, even though it can't
  4. ; throw a synchronous exception.
  5. define i32 @div(i32 %n, i32 %d) nounwind {
  6. entry:
  7. %div = sdiv i32 %n, %d
  8. ret i32 %div
  9. }
  10. define i32 @main() nounwind personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) {
  11. entry:
  12. %call = invoke i32 @div(i32 10, i32 0)
  13. to label %__try.cont unwind label %lpad
  14. lpad:
  15. %0 = landingpad { i8*, i32 }
  16. catch i8* null
  17. br label %__try.cont
  18. __try.cont:
  19. %retval.0 = phi i32 [ %call, %entry ], [ 0, %lpad ]
  20. ret i32 %retval.0
  21. }
  22. ; CHECK-LABEL: define i32 @main()
  23. ; CHECK: invoke i32 @div(i32 10, i32 0)
  24. declare i32 @__C_specific_handler(...)