https://llvm.org/bugs/show_bug.cgi?id=28383
Bug ID: 28383 Summary: Context-sensitivity of the inline cost Product: libraries Version: trunk Hardware: PC OS: All Status: NEW Severity: normal Priority: P Component: Interprocedural Optimizations Assignee: unassignedb...@nondot.org Reporter: apilipe...@azulsystems.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified In order to estimate the cost of inlining for a given call site InlineCost analyzes the body of the callee AND the caller context. For example, if one of the arguments is known to be non-null in the caller InlineCost takes this fact into account and discounts the cost of a null-check on this argument in the callee. The current pass manager doesn't account for this context-sensitivity. CallGraphSCC pass manager traverses SCCs of the call graph in the bottom-up order running inliner and a set of simplification passes on each SCC. This way inliner always looks at optimized inlining candidates which increases chances of inlining. Because of context-sensitivity of the inline cost optimizations of the current SCC might enable more inlining in this SCC. Although, the pass manager doesn't expect that and doesn't try to inline in this SCC again after simplifications unless simplifications resulted in devirtualization. The pass manager should expect that new inlineable call sites can appear as a result of simplifications other than devirtualization and should iterate on the current SCC as long as the inliner makes progress. For example, initial function: foo(%a) { checkNonNull(%a) foo_impl(%a) } checkNonNull has been inlined and instcombine has propagated context-sensitive non-null fact to the call-site: foo(%a) { if (%a == null) uncommon trap foo_impl(nonnull %a) } Knowledge about %a being not-null might enable inlining of foo_impl. But the inliner never tries to inline call sites in foo after that. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs