HomePhabricator

[PowerPC] Remove CRBits Copy Of Unset/set CBit

Description

[PowerPC] Remove CRBits Copy Of Unset/set CBit

For the situation, where we generate the following code:

crxor 8, 8, 8
< Some instructions>

.LBB0_1:

< Some instructions>
cror 1, 8, 8

cror (COPY of CRbit) depends on the result of the crxor instruction.
CR8 is known to be zero as crxor is equivalent to CRUNSET. We can simply use
crxor 1, 1, 1 instead to zero out CR1, which does not have any dependency on
any previous instruction.

This patch will optimize it to:

< Some instructions>

.LBB0_1:

< Some instructions>
cror 1, 1, 1

Patch By: Victor Huang (NeHuang)

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