[PATCH] D62860: Aggressively hoist guards out of loops (to provide a target for widening)

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 4 08:47:15 PDT 2019


reames created this revision.
reames added reviewers: apilipenko, fedor.sergeev, skatkov.
Herald added subscribers: bollu, mcrosier.
Herald added a project: LLVM.

If we have a guard w/loop invariant operands, which is reached along a side effect free path on the first iteration, we can hoist that guard outside the loop, even over control flow we can not analyse.  Doing so may widen the condition - make it fail on more executions than the original program - but that's explicitly allowed by the documented semantics of guards.

At the moment, I'm mostly looking for feedback on approach.  Is this the right framing and placement?  As noted in the comment, I'm considering an alternate "spliting" framing, would that be cleaner?

I need to add dedicated tests and will rebase when done so, but for now, the GuardWidening/basics.ll test show the difference fairly well.  (I have not included the output in the diff yet.)


Repository:
  rL LLVM

https://reviews.llvm.org/D62860

Files:
  lib/Transforms/Scalar/GuardWidening.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62860.202951.patch
Type: text/x-patch
Size: 4335 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190604/4e9da7d5/attachment.bin>


More information about the llvm-commits mailing list