[PATCH] D34049: [LoopSimplify] Factor the logic to form dedicated exits into a utility.

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 9 03:38:38 PDT 2017


chandlerc created this revision.
Herald added subscribers: mcrosier, sanjoy.

I want to use the same logic as LoopSimplify to form dedicated exits in
another pass (SimpleLoopUnswitch) so I wanted to factor it out here.

I also noticed that there is a pretty significantly more efficient way
to implement this than the way the code in LoopSimplify worked. We don't
need to actually retain the set of unique exit blocks, we can just
rewrite them as we find them and use only a set to deduplicate.

This did require changing one part of LoopSimplify to not re-use the
unique set of exits, but it only used it to check that there was
a single unique exit. That part of the code is about to walk the exiting
blocks anyways, so it seemed better to rewrite it to use those exiting
blocks to compute this property on-demand.

I also had to ditch a statistic, but it doesn't seem terribly valuable.


https://reviews.llvm.org/D34049

Files:
  include/llvm/Transforms/Utils/LoopUtils.h
  lib/Transforms/Utils/LoopSimplify.cpp
  lib/Transforms/Utils/LoopUtils.cpp
  test/Transforms/LoopUnswitch/2011-11-18-SimpleSwitch.ll
  test/Transforms/LoopUnswitch/2011-11-18-TwoSwitches-Threshold.ll
  test/Transforms/LoopUnswitch/2011-11-18-TwoSwitches.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34049.102010.patch
Type: text/x-patch
Size: 10765 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170609/2e827b32/attachment.bin>


More information about the llvm-commits mailing list