1cee313d2SEric Christopher; RUN: opt < %s -S -partial-inliner -skip-partial-inlining-cost-analysis=true | FileCheck %s 2cee313d2SEric Christopher 3cee313d2SEric Christopher 4cee313d2SEric Christopherdefine i32 @callee_most(i32 %v) unnamed_addr #0 #1 { 5cee313d2SEric Christopherentry: 6cee313d2SEric Christopher %cmp = icmp sgt i32 %v, 2000 7cee313d2SEric Christopher br i1 %cmp, label %if.then, label %if.end 8cee313d2SEric Christopher 9cee313d2SEric Christopherif.then: 10cee313d2SEric Christopher br label %if.then2 11cee313d2SEric Christopher 12cee313d2SEric Christopherif.then2: 13cee313d2SEric Christopher %sub = sub i32 %v, 10 14cee313d2SEric Christopher br label %if.end 15cee313d2SEric Christopher 16cee313d2SEric Christopherif.end: 17cee313d2SEric Christopher %v2 = phi i32 [ %v, %entry ], [ %sub, %if.then2 ] 18cee313d2SEric Christopher %add = add nsw i32 %v2, 200 19cee313d2SEric Christopher ret i32 %add 20cee313d2SEric Christopher} 21cee313d2SEric Christopher 22cee313d2SEric Christopherdefine i32 @callee_noinline(i32 %v) optnone noinline { 23cee313d2SEric Christopherentry: 24cee313d2SEric Christopher %cmp = icmp sgt i32 %v, 2000 25cee313d2SEric Christopher br i1 %cmp, label %if.then, label %if.end 26cee313d2SEric Christopher 27cee313d2SEric Christopherif.then: 28cee313d2SEric Christopher br label %if.then2 29cee313d2SEric Christopher 30cee313d2SEric Christopherif.then2: 31cee313d2SEric Christopher %sub = sub i32 %v, 10 32cee313d2SEric Christopher br label %if.end 33cee313d2SEric Christopher 34cee313d2SEric Christopherif.end: 35cee313d2SEric Christopher %v2 = phi i32 [ %v, %entry ], [ %sub, %if.then2 ] 36cee313d2SEric Christopher %add = add nsw i32 %v2, 200 37cee313d2SEric Christopher ret i32 %add 38cee313d2SEric Christopher} 39cee313d2SEric Christopher 40bc044a88SNick Desaulniersdefine i32 @callee_writeonly(i32 %v) writeonly ssp { 41cee313d2SEric Christopherentry: 42cee313d2SEric Christopher %cmp = icmp sgt i32 %v, 2000 43cee313d2SEric Christopher br i1 %cmp, label %if.then, label %if.end 44cee313d2SEric Christopher 45cee313d2SEric Christopherif.then: 46cee313d2SEric Christopher br label %if.then2 47cee313d2SEric Christopher 48cee313d2SEric Christopherif.then2: 49cee313d2SEric Christopher %sub = sub i32 %v, 10 50cee313d2SEric Christopher br label %if.end 51cee313d2SEric Christopher 52cee313d2SEric Christopherif.end: 53cee313d2SEric Christopher %v2 = phi i32 [ %v, %entry ], [ %sub, %if.then2 ] 54cee313d2SEric Christopher %add = add nsw i32 %v2, 200 55cee313d2SEric Christopher ret i32 %add 56cee313d2SEric Christopher} 57cee313d2SEric Christopher; CHECK-LABEL: @caller 58cee313d2SEric Christopher; CHECK: call void @callee_most.2.if.then(i32 %v 59cee313d2SEric Christopher; CHECK: call i32 @callee_noinline(i32 %v) 60cee313d2SEric Christopher; CHECK: call void @callee_writeonly.1.if.then(i32 %v 61bc044a88SNick Desaulniersdefine i32 @caller(i32 %v) ssp { 62cee313d2SEric Christopherentry: 63cee313d2SEric Christopher %c1 = call i32 @callee_most(i32 %v) 64cee313d2SEric Christopher %c2 = call i32 @callee_noinline(i32 %v) 65cee313d2SEric Christopher %c3 = call i32 @callee_writeonly(i32 %v) 66cee313d2SEric Christopher ret i32 %c3 67cee313d2SEric Christopher} 68cee313d2SEric Christopher 69*41d5033eSNikita Popov; CHECK: define internal void @callee_writeonly.1.if.then(i32 %v, ptr %sub.out) [[FN_ATTRS0:#[0-9]+]] 70*41d5033eSNikita Popov; CHECK: define internal void @callee_most.2.if.then(i32 %v, ptr %sub.out) [[FN_ATTRS:#[0-9]+]] 71cee313d2SEric Christopher 72cee313d2SEric Christopher; attributes to preserve 73cee313d2SEric Christopherattributes #0 = { 74cee313d2SEric Christopher inlinehint minsize noduplicate noimplicitfloat norecurse noredzone nounwind 75cee313d2SEric Christopher nonlazybind optsize safestack sanitize_address sanitize_hwaddress sanitize_memory 7647b3b768SSerge Pavlov sanitize_thread ssp sspreq sspstrong uwtable "foo"="bar" 77cee313d2SEric Christopher "patchable-function"="prologue-short-redirect" "probe-stack"="_foo_guard" "stack-probe-size"="4096" } 78cee313d2SEric Christopher 79bc044a88SNick Desaulniers; CHECK: attributes [[FN_ATTRS0]] = { ssp 8047b3b768SSerge Pavlov; CHECK: attributes [[FN_ATTRS]] = { inlinehint minsize noduplicate noimplicitfloat norecurse noredzone nounwind nonlazybind optsize safestack sanitize_address sanitize_hwaddress sanitize_memory sanitize_thread ssp sspreq sspstrong uwtable "foo"="bar" "patchable-function"="prologue-short-redirect" "probe-stack"="_foo_guard" "stack-probe-size"="4096" } 81cee313d2SEric Christopher 82cee313d2SEric Christopher; attributes to drop 83cee313d2SEric Christopherattributes #1 = { 84cee313d2SEric Christopher alignstack=16 convergent inaccessiblememonly inaccessiblemem_or_argmemonly naked 85cee313d2SEric Christopher noreturn readonly argmemonly returns_twice speculatable "thunk" 86cee313d2SEric Christopher} 87