33 lines · plain
1; Test to ensure that the inlining cost model isn't tripped up by dead constant users.2; In this case, the call to g via a bitcasted function pointer is canonicalized to3; a direct call to g with bitcasted arguments, leaving the original bitcast4; as a dead use of g.5 6; RUN: opt < %s -passes='function(instcombine),cgscc(inline)' -pass-remarks=inline -S 2>&1 \7; RUN: | FileCheck %s8 9; Inline costs of f and g should be the same.10 11; CHECK: 'f' inlined into 'h' with (cost=[[EXPECTED_COST:.+]], threshold={{.+}})12; CHECK: 'g' inlined into 'h' with (cost=[[EXPECTED_COST]], threshold={{.+}})13 14%0 = type { i64, i64, i64 }15%1 = type { i64, i64, i64 }16 17define internal void @f(ptr align 8 %a) unnamed_addr {18start:19 ret void20}21 22define internal void @g(ptr align 8 %a) unnamed_addr {23start:24 ret void25}26 27define void @h(ptr align 8 %a, ptr align 8 %b) unnamed_addr {28start:29 call void @f(ptr align 8 %a)30 call void @g(ptr align 8 %b)31 ret void32}33