invoke_test-3.ll 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. ; Test that any rethrown exceptions in an inlined function are automatically
  2. ; turned into branches to the invoke destination.
  3. ; RUN: opt < %s -inline -S | not grep unwind$
  4. declare void @might_throw()
  5. define internal i32 @callee() personality i32 (...)* @__gxx_personality_v0 {
  6. invoke void @might_throw( )
  7. to label %cont unwind label %exc
  8. cont: ; preds = %0
  9. ret i32 0
  10. exc: ; preds = %0a
  11. ; This just rethrows the exception!
  12. %exn = landingpad {i8*, i32}
  13. cleanup
  14. resume { i8*, i32 } %exn
  15. }
  16. ; caller returns true if might_throw throws an exception... which gets
  17. ; propagated by callee.
  18. define i32 @caller() personality i32 (...)* @__gxx_personality_v0 {
  19. %X = invoke i32 @callee( )
  20. to label %cont unwind label %Handler ; <i32> [#uses=1]
  21. cont: ; preds = %0
  22. ret i32 %X
  23. Handler: ; preds = %0
  24. ; This consumes an exception thrown by might_throw
  25. %exn = landingpad {i8*, i32}
  26. cleanup
  27. ret i32 1
  28. }
  29. declare i32 @__gxx_personality_v0(...)