[PATCH] D42637: [PowerPC] Check hot loop exit edge in PPCCTRLoops

Hiroshi Inoue via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 04:47:42 PST 2018


inouehrs created this revision.
inouehrs added reviewers: hfinkel, echristo, kbarton, nemanjai, jtony, sfertile, lei, syzaara.

PPCCTRLoops transform loops using mtctr/bdnz instructions if loop trip count is known.
But if there is a loop exit edge which is known to be frequently taken (by builtin_expect or by PGO), we should not transform the loop to avoid the cost of mtctr instruction. Here is an example of a loop with hot exit edge:

  for (unsigned i = 0; i < TripCount; i++) {
    // do something
    if (__builtin_expect(check(), 1))
      break;
    // do something
  }




https://reviews.llvm.org/D42637

Files:
  lib/Target/PowerPC/PPCCTRLoops.cpp
  test/CodeGen/PowerPC/ctrloops-hot-exit.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42637.131767.patch
Type: text/x-patch
Size: 4341 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180129/6f918621/attachment.bin>


More information about the llvm-commits mailing list