<div dir="ltr">Could you please provide a specific ll test and we will be able to consider what happened in details using debugger</div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-06-03 2:41 GMT+04:00 Gerolf Hoflehner <span dir="ltr"><<a href="mailto:ghoflehner@apple.com" target="_blank">ghoflehner@apple.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
we noticed that combining instructions at the ISEL level can result in sub-optimal schedules, since an expensive instruction could be folded and lengthen the critical path. A simple illustrative example for this is folding mul-mul-add into mul-madd (fused multiply add), which serializes two multiplications instead of allowing them to execute in parallel. Unfortunately ISEL does not have the information necessary to avoid sub-optimial cases in all instances. The alternative is to post-pone instruction combining to a later pass and decide on whether the combined code sequence  performs better. This combiner pass would run at the machine IR level, use the machine trace model information,  and roughly implement the following architecture independent algorithm initially targeting mul-add/sub pattern:<br>

<br>
* Initial Instruction Combiner Algorithm<br>
0. Recognize instruction patterns in a single basic block<br>
1. For each add/sub check if it can be combined to madd/msub<br>
2. For each pattern found, generate the alternative instruction sequence outside the basic block that contains mul - add/sub<br>
3. Evaluate if the new pattern is more efficient:<br>
a) In Os substitute when the new pattern has fewer instructions<br>
b) Otherwise substitute when neither critical path nor resource length increases based on the machine trace model<br>
<br>
Do you have any concerns? Or is this the pass you always wanted? :-)<br>
<br>
Cheers<br>
Gerolf<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br></div>