diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp --- a/llvm/lib/CodeGen/MachineOutliner.cpp +++ b/llvm/lib/CodeGen/MachineOutliner.cpp @@ -95,6 +95,11 @@ cl::desc("Enable the machine outliner on linkonceodr functions"), cl::init(false)); +static cl::opt OutlinerReruns( + "outliner-reruns", cl::init(0), cl::Hidden, + cl::desc( + "Number of times to rerun the outliner after the initial outline")); + namespace { /// Represents an undefined index in the suffix tree. @@ -1427,6 +1432,11 @@ if (!doOutline(M, OutlinedFunctionNum)) return false; + + for (unsigned I = 0; I < OutlinerReruns; ++I) + if (!doOutline(M, OutlinedFunctionNum)) + return true; + return true; }