[FunctionAttrs] Provide a single SCC node set to all of the
authorChandler Carruth <chandlerc@gmail.com>
Thu, 29 Oct 2015 18:29:15 +0000 (18:29 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 29 Oct 2015 18:29:15 +0000 (18:29 +0000)
commit6f27cebd4c544cd239df59842998149e1b389205
treeca4ce4f62d935d3719404253f720114ca2e34787
parent0dd6fbaf265388ab0fa21ad6bfdf9f70547bc7ae
[FunctionAttrs] Provide a single SCC node set to all of the
transformations in FunctionAttrs rather than building a new one each
time.

This isn't trivial because there are different heuristics from different
passes for exactly what set they want. The primary difference is whether
an *overridable* function completely disables the synthesis of
attributes. I've modeled this by directly testing for overridable, and
using the common set that excludes external and opt-none functions.

This does cause some changes by disabling more optimizations in the face
of opt-none. Specifically, we were still optimizing *calls* to opt-none
functions based on their attributes, just not the bodies. It seems
better to be conservative on both fronts given the intended semanticas
here (best effort to not assume or disturb anything). I've not tried to
test this change as it seems complex, brittle, and not important to the
implicit contract of opt-none. Instead, it seems more like a choice that
should be dictated by the simplified implementation and the change to be
acceptable differences within the space of opt-none.

A big benefit here is that these transformations no longer rely on the
legacy pass manager's SCC types, they just work on generic sets of
function pointers. This will make it easy to re-use their logic in the
new pass manager.

I've also made the transforms static functions instead of members where
trivial while I was touching the signatures.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251640 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/IPO/FunctionAttrs.cpp