[PATCH] D52345: [PowerPC] optimize conditional branch on CRSET/CRUNSET

Hiroshi Inoue via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 21 02:45:43 PDT 2018


inouehrs created this revision.
inouehrs added reviewers: hfinkel, echristo, power-llvm-team.
Herald added subscribers: jsji, kbarton, nemanjai.

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 also eliminated if the condition code register is not used by instruction other than the branch to be optimized.

I observed such redundancy happened around 150 times while building LLVM bootctrap.


https://reviews.llvm.org/D52345

Files:
  lib/Target/PowerPC/PPCPreEmitPeephole.cpp
  test/CodeGen/PowerPC/setcr_bc.mir
  test/CodeGen/PowerPC/setcr_bc2.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52345.166421.patch
Type: text/x-patch
Size: 15106 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180921/52a4cd29/attachment.bin>


More information about the llvm-commits mailing list