[PATCH] D49974: [GuardWidening] Widen guards with conditions of frequently taken dominated branches

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 30 00:37:21 PDT 2018


mkazantsev created this revision.
mkazantsev added reviewers: apilipenko, fedor.sergeev, sanjoy, reames.

If there is a frequently taken branch dominated by a guard, and its condition is available
at the point of the guard, we can widen guard with condition of this branch and convert
the branch into unconditional:

  guard(cond1)
  if (cond2) {
    // taken in 99.9% cases
    // do something
  } else {
    // do something else    
  }

Converts to

  guard(cond1 && cond2)
  // do something


https://reviews.llvm.org/D49974

Files:
  lib/Transforms/Scalar/GuardWidening.cpp
  test/Transforms/GuardWidening/widen-frequent-branches.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49974.157920.patch
Type: text/x-patch
Size: 18755 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180730/61ae85ff/attachment.bin>


More information about the llvm-commits mailing list