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 @@ -96,6 +96,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. @@ -1434,6 +1439,11 @@ if (!doOutline(M, OutlinedFunctionNum)) return false; + + for (unsigned I = 0; I < OutlinerReruns; ++I) + if (!doOutline(M, OutlinedFunctionNum)) + return true; + return true; }