OSDN Git Service

Move duplicated code into a helper function (exposed through overload).
authorEli Bendersky <eliben@google.com>
Wed, 12 Mar 2014 16:12:36 +0000 (16:12 +0000)
committerEli Bendersky <eliben@google.com>
Wed, 12 Mar 2014 16:12:36 +0000 (16:12 +0000)
commitce306f9f99e3211dec0ff567073fd5bc86b6c99e
tree5b373efcb4add039519b1b00e3bb728e7bb74e47
parent3d37204ca6514d5d1e2c43fbf85dfeba08c83175
Move duplicated code into a helper function (exposed through overload).

There's a bit of duplicated "magic" code in opt.cpp and Clang's CodeGen that
computes the inliner threshold from opt level and size opt level.

This patch moves the code to a function that lives alongside the inliner itself,
providing a convenient overload to the inliner creation.

A separate patch can be committed to Clang to use this once it's committed to
LLVM. Standalone tools that use the inlining pass can also avoid duplicating
this code and fearing it will go out of sync.

Note: this patch also restructures the conditinal logic of the computation to
be cleaner.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203669 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Transforms/IPO.h
lib/Transforms/IPO/InlineSimple.cpp
tools/opt/opt.cpp