[llvm-dev] [CodeGen] PeepholeOptimizer: optimizing condition dependent instrunctions
Evgeny Astigeevich via llvm-dev
llvm-dev at lists.llvm.org
Wed Mar 9 06:28:51 PST 2016
Hi,
I find it's quite strange how condition dependent instructions are processed in PeepholeOptimizer::runOnMachineFunction:
01577 if ((isUncoalescableCopy(*MI) &&
01578 optimizeUncoalescableCopy(MI, LocalMIs)) ||
01579 (MI->isCompare() && optimizeCmpInstr(MI, &MBB)) ||
01580 (MI->isSelect() && optimizeSelect(MI, LocalMIs))) {
01581 // MI is deleted.
01582 LocalMIs.erase(MI);
01583 Changed = true;
01584 continue;
01585 }
01586
01587 if (MI->isConditionalBranch() && optimizeCondBranch(MI)) {
01588 Changed = true;
01589 continue;
01590 }
CmpInstr, SelectInstr and CondBranch are processed separately. It's assumed that CmpInstr and SelectInstr are deleted but CondBranch is not.
In fact CmpInstr is always connected to SelectInstr or CondBranch or both of them. So if such connection exists it should be processed as a whole.
For example, there are cases when CMP+BRC can be replaced by BR. The same is true for CMP+SEL.
The main problem I have is that I have to find corresponding CmpInstr and to repeat analysis of it in optimizeSelect and in optimizeCondBranch.
Any thoughts why it's implemented in such way.
Kind regards,
Evgeny Astigeevich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160309/6492eef9/attachment.html>
More information about the llvm-dev
mailing list