1*9880d681SAndroid Build Coastguard Worker; RUN: opt -S -inline %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Workerdeclare void @foo() 4*9880d681SAndroid Build Coastguard Workerdeclare void @bar() 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Workerdefine void @callee(i8* %arg) { 7*9880d681SAndroid Build Coastguard Worker %cmp = icmp eq i8* %arg, null 8*9880d681SAndroid Build Coastguard Worker br i1 %cmp, label %expensive, label %done 9*9880d681SAndroid Build Coastguard Worker 10*9880d681SAndroid Build Coastguard Worker; This block is designed to be too expensive to inline. We can only inline 11*9880d681SAndroid Build Coastguard Worker; callee if this block is known to be dead. 12*9880d681SAndroid Build Coastguard Workerexpensive: 13*9880d681SAndroid Build Coastguard Worker call void @foo() 14*9880d681SAndroid Build Coastguard Worker call void @foo() 15*9880d681SAndroid Build Coastguard Worker call void @foo() 16*9880d681SAndroid Build Coastguard Worker call void @foo() 17*9880d681SAndroid Build Coastguard Worker call void @foo() 18*9880d681SAndroid Build Coastguard Worker call void @foo() 19*9880d681SAndroid Build Coastguard Worker call void @foo() 20*9880d681SAndroid Build Coastguard Worker call void @foo() 21*9880d681SAndroid Build Coastguard Worker call void @foo() 22*9880d681SAndroid Build Coastguard Worker call void @foo() 23*9880d681SAndroid Build Coastguard Worker ret void 24*9880d681SAndroid Build Coastguard Worker 25*9880d681SAndroid Build Coastguard Workerdone: 26*9880d681SAndroid Build Coastguard Worker call void @bar() 27*9880d681SAndroid Build Coastguard Worker ret void 28*9880d681SAndroid Build Coastguard Worker} 29*9880d681SAndroid Build Coastguard Worker 30*9880d681SAndroid Build Coastguard Worker; Positive test - arg is known non null 31*9880d681SAndroid Build Coastguard Workerdefine void @caller(i8* nonnull %arg) { 32*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @caller 33*9880d681SAndroid Build Coastguard Worker; CHECK: call void @bar() 34*9880d681SAndroid Build Coastguard Worker call void @callee(i8* nonnull %arg) 35*9880d681SAndroid Build Coastguard Worker ret void 36*9880d681SAndroid Build Coastguard Worker} 37*9880d681SAndroid Build Coastguard Worker 38*9880d681SAndroid Build Coastguard Worker; Negative test - arg is not known to be non null 39*9880d681SAndroid Build Coastguard Workerdefine void @caller2(i8* %arg) { 40*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @caller2 41*9880d681SAndroid Build Coastguard Worker; CHECK: call void @callee( 42*9880d681SAndroid Build Coastguard Worker call void @callee(i8* %arg) 43*9880d681SAndroid Build Coastguard Worker ret void 44*9880d681SAndroid Build Coastguard Worker} 45*9880d681SAndroid Build Coastguard Worker 46