[PATCH] D36404: TTI interface for creating jump-threaded branches into loop headers

Krzysztof Parzyszek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 7 08:52:48 PDT 2017


kparzysz created this revision.
Herald added a subscriber: mehdi_amini.

Consider this type of a loop:

  for (...) {
    ...
    if (...) continue;
    ...
  }

Normally, the "continue" would branch to the loop control code that checks whether the loop should continue iterating and which contains the (often) unique loop latch branch.  In certain cases jump threading can "thread" the inner branch directly to the loop header, creating a second loop latch.  Loop canonicalization would then transform this loop into a loop nest.  The problem with this is that in such a loop nest neither loop is countable even if the original loop was.  This may inhibit subsequent loop optimizations and be detrimental to performance.  This patch allows the target to decide whether such jump-threading should be allowed in a case-by-case basis.  The default decision is to allow it, maintaining the current behavior.


Repository:
  rL LLVM

https://reviews.llvm.org/D36404

Files:
  include/llvm/Analysis/TargetTransformInfo.h
  include/llvm/Analysis/TargetTransformInfoImpl.h
  include/llvm/Transforms/Scalar/JumpThreading.h
  lib/Analysis/TargetTransformInfo.cpp
  lib/Target/Hexagon/HexagonTargetTransformInfo.h
  lib/Transforms/Scalar/JumpThreading.cpp
  test/CodeGen/Hexagon/jump-threading-headers.ll
  test/Other/new-pm-lto-defaults.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36404.110009.patch
Type: text/x-patch
Size: 10861 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170807/a1ffc23c/attachment.bin>


More information about the llvm-commits mailing list