[MachineOutliner] Don't store outlined function numberings on OutlinedFunction
authorJessica Paquette <jpaquette@apple.com>
Wed, 7 Nov 2018 18:36:43 +0000 (18:36 +0000)
committerJessica Paquette <jpaquette@apple.com>
Wed, 7 Nov 2018 18:36:43 +0000 (18:36 +0000)
commita3eb0fac3be2373516d454717d8f4584831908ec
treef4e3796ec7650a332eaad894a2a35dbe8dc45ef2
parent5dc0fba2e38a63f861462e7e57a346afffc786d6
[MachineOutliner] Don't store outlined function numberings on OutlinedFunction

NFC-ish. This doesn't change the behaviour of the outliner, but does make sure
that you won't end up with say

OUTLINED_FUNCTION_2:
...
ret

OUTLINED_FUNCTION_248:
...
ret

as the only outlined functions in your module. Those should really be

OUTLINED_FUNCTION_0:
...
ret

OUTLINED_FUNCTION_1:
...
ret

If we produce outlined functions, they probably should have sequential numbers
attached to them. This makes it a bit easier+stable to write outliner tests.

The point of this is to move towards a bit more stability in outlined function
names. By doing this, we at least don't rely on the traversal order of the
suffix tree. Instead, we rely on the order of the candidate list, which is
*far* more consistent. The candidate list is ordered by the end indices of
candidates, so we're more likely to get a stable ordering. This is still
susceptible to changes in the cost model though (like, if we suddenly find new
candidates, for example).

llvm-svn: 346340
llvm/include/llvm/CodeGen/MachineOutliner.h
llvm/lib/CodeGen/MachineOutliner.cpp