Eric Christopher | cee313d | 2019-04-17 04:52:47 +0000 | [diff] [blame] | 1 | ; RUN: opt -inline < %s -S -o - -inline-threshold=100 | FileCheck %s |
| 2 | ; RUN: opt -passes='cgscc(inline)' < %s -S -o - -inline-threshold=100 | FileCheck %s |
| 3 | |
| 4 | target datalayout = "p:32:32" |
| 5 | |
| 6 | @glbl = external global i32 |
| 7 | |
| 8 | declare void @f() |
| 9 | declare i32 @__gxx_personality_v0(...) |
| 10 | declare i8* @__cxa_begin_catch(i8*) |
| 11 | declare void @__cxa_end_catch() |
| 12 | declare void @_ZSt9terminatev() |
| 13 | |
| 14 | define void @inner1() personality i32 (...)* @__gxx_personality_v0 { |
| 15 | entry: |
| 16 | invoke void @f() to label %cont1 unwind label %terminate.lpad |
| 17 | |
| 18 | cont1: |
| 19 | invoke void @f() to label %cont2 unwind label %terminate.lpad |
| 20 | |
| 21 | cont2: |
| 22 | invoke void @f() to label %cont3 unwind label %terminate.lpad |
| 23 | |
| 24 | cont3: |
| 25 | invoke void @f() to label %cont4 unwind label %terminate.lpad |
| 26 | |
| 27 | cont4: |
| 28 | ret void |
| 29 | |
| 30 | terminate.lpad: |
| 31 | landingpad {i8*, i32} |
| 32 | catch i8* null |
| 33 | call void @_ZSt9terminatev() noreturn nounwind |
| 34 | unreachable |
| 35 | } |
| 36 | |
| 37 | define void @outer1() { |
| 38 | ; CHECK-LABEL: @outer1( |
| 39 | ; |
| 40 | ; This call should not get inlined because inner1 actually calls a function |
| 41 | ; many times, but it only does so through invoke as opposed to call. |
| 42 | ; |
| 43 | ; CHECK: call void @inner1 |
| 44 | call void @inner1() |
| 45 | ret void |
| 46 | } |