[PATCH] D35411: [SimplifyCFG] Defer folding unconditional branches to LateSimplifyCFG if it can destroy canonical loop structure.

Balaram Makam via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 14 09:29:12 PDT 2017


bmakam updated this revision to Diff 106651.
bmakam added a comment.

In https://reviews.llvm.org/D35411#809670, @mcrosier wrote:

> Let me see if I can describe the problem and your approach to fixing the issue in my own words.
>
> Currently, JumpThreading and SimplifyCFG avoid threading/merging "empty" loop headers as this would break the canonical form of the loop; the CFG edge being optimized is between the loop header and its successor.  Your approach is to also avoid merging the incoming edges (i.e., back edges) to the loop header as well to avoid breaking the canonical form of the loop.  Then later in late-SimplifyCFG and CodeGen prepare you more aggressively remove these empty blocks.
>
> Sound about right?


Thanks Chad,
That's right.


https://reviews.llvm.org/D35411

Files:
  lib/CodeGen/CodeGenPrepare.cpp
  lib/Transforms/Scalar/JumpThreading.cpp
  lib/Transforms/Utils/SimplifyCFG.cpp
  test/CodeGen/AArch64/aarch64-loop-gep-opt.ll
  test/Transforms/JumpThreading/static-profile.ll
  test/Transforms/LoopUnroll/peel-loop.ll
  test/Transforms/LoopUnroll/pr33605.ll
  test/Transforms/LoopUnswitch/2015-06-17-Metadata.ll
  test/Transforms/LoopUnswitch/infinite-loop.ll
  test/Transforms/LoopVectorize/X86/float-induction-x86.ll
  test/Transforms/LoopVectorize/float-induction.ll
  test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll
  test/Transforms/SimplifyCFG/multiple-phis.ll
  test/Transforms/SimplifyCFG/preserve-llvm-loop-metadata.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35411.106651.patch
Type: text/x-patch
Size: 16501 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170714/0beb1f01/attachment.bin>


More information about the llvm-commits mailing list