OSDN Git Service

[PowerPC] optimize conditional branch on CRSET/CRUNSET
authorHiroshi Inoue <inouehrs@jp.ibm.com>
Wed, 26 Sep 2018 12:32:45 +0000 (12:32 +0000)
committerHiroshi Inoue <inouehrs@jp.ibm.com>
Wed, 26 Sep 2018 12:32:45 +0000 (12:32 +0000)
commit54312c3d1b755f4cf6ec664e0bf21212cb1ccf9e
tree87ec1b160682efdbcc1a15dddc0e52f71ef8ddf3
parent3fccee2ee8cce1b0a9d9b03d9ee9c0ccd3eeb430
[PowerPC] optimize conditional branch on CRSET/CRUNSET

This patch adds a check to optimize conditional branch (BC and BCn) based on a constant set by CRSET or CRUNSET.
Other optimizers, such as block placement, may generate such code and hence
I do this at the very end of the optimization in pre-emit peephole pass.

A conditional branch based on a constant is eliminated or converted into unconditional branch.
Also CRSET/CRUNSET is eliminated if the condition code register is not used
by instruction other than the branch to be optimized.

Differential Revision: https://reviews.llvm.org/D52345

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343100 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/PowerPC/PPCPreEmitPeephole.cpp
test/CodeGen/PowerPC/setcr_bc.mir [new file with mode: 0644]
test/CodeGen/PowerPC/setcr_bc2.mir [new file with mode: 0644]