invoke_test-2.ll 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. ; Test that if an invoked function is inlined, and if that function cannot
  2. ; throw, that the dead handler is now unreachable.
  3. ; RUN: opt < %s -inline -simplifycfg -S | \
  4. ; RUN: not grep UnreachableExceptionHandler
  5. declare void @might_throw()
  6. define internal i32 @callee() personality i32 (...)* @__gxx_personality_v0 {
  7. invoke void @might_throw( )
  8. to label %cont unwind label %exc
  9. cont: ; preds = %0
  10. ret i32 0
  11. exc: ; preds = %0
  12. %exn = landingpad {i8*, i32}
  13. cleanup
  14. ret i32 1
  15. }
  16. ; caller returns true if might_throw throws an exception... callee cannot throw.
  17. define i32 @caller() personality i32 (...)* @__gxx_personality_v0 {
  18. %X = invoke i32 @callee( )
  19. to label %cont unwind label %UnreachableExceptionHandler ; <i32> [#uses=1]
  20. cont: ; preds = %0
  21. ret i32 %X
  22. UnreachableExceptionHandler: ; preds = %0
  23. %exn = landingpad {i8*, i32}
  24. cleanup
  25. ret i32 -1
  26. }
  27. declare i32 @__gxx_personality_v0(...)