<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/80793>80793</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
OPT, Split the code based on the Outliner mechanism to provide a better input for optimize PASS
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
joyhou-hw
</td>
</tr>
</table>
<pre>
I'm currently working on some compiler optimization analysis.
I read some of the code written by the developers, and they all have some characteristics.
1: The code written by the developer revolves around the business logic. And multiple scenarios need to be covered.
One func code may be like:
```
If a = true
do somethings call some sub funcs.
If b = true;
do some other things. Call some others funcs.
```
2: Only one scenario can be used at a time during program running.
3: Existing optimizations, such as inlining, hot and cold partitioning, BB reoder, and function reoder, cannot solve the problem well. They are more like stitching on a code that is not performing well.
Recently I've been debugging IROutliner PASS. I found that IROutliner PASS can extract an outliner function from the same code block of two functions. Used to reduce code size.
My idea is: Can we split the business function into CFG part and branch code part components before the optimization starts.
Split the service logic-preferred code written by developers, and then use the profile to combine the code into performance-preferred code.
Provide more excellent input for the following optimization PASS.
![image](https://github.com/llvm/llvm-project/assets/83800290/7dd4cc21-5572-439e-a510-63231b232ded)
The optimized code breaks the function boundary restriction and is arranged more compactly based on the actual service logic, achieving better local benefits.
Is this kind of idea feasible?
Has anyone already developed something in this direction?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVU2P2zgM_TXOhUjgyM4kOeQwH5vdOSymaLs_gJKYWB1ZMig5afrrF5LtpJkWWCww8CAS_cjH90hjCOboiHbF6qlYvcywj43n3Td_aXw_b84z6fVl91qIdQuqZyYX7QXOnt-NO4J3EHxLoHzbGUsMvoumNT8wGu8AHdpLMGFRlC9F-fgKTKiHF_wBYpPe0wRnNjGSA3nJZ5pOZH1HHArxDOh0Or0AWgsNnmhM2CCjisQmRKOmDMNzWVSPAF__Cx6YTt6eKACy74c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