diff options
author | Kit Barton <kbarton@ca.ibm.com> | 2019-05-23 17:56:35 +0000 |
---|---|---|
committer | Kit Barton <kbarton@ca.ibm.com> | 2019-05-23 17:56:35 +0000 |
commit | 2049e4dd8f61100f88f14db33bd95d197bcbfbbc (patch) | |
tree | 84e53e4efae4d0d729abd26c19637936606e3e31 /clang/test/Frontend | |
parent | eafe8ef6f2b44baf5a84658caca90c2f9c1849ca (diff) | |
download | bcm5719-llvm-2049e4dd8f61100f88f14db33bd95d197bcbfbbc.tar.gz bcm5719-llvm-2049e4dd8f61100f88f14db33bd95d197bcbfbbc.zip |
[LOOPINFO] Extend Loop object to add utilities to get the loop bounds, step, induction variable, and guard branch.
Summary:
This PR extends the loop object with more utilities to get loop bounds, step, induction variable, and guard branch. There already exists passes which try to obtain the loop induction variable in their own pass, e.g. loop interchange. It would be useful to have a common area to get these information. Moreover, loop fusion (https://reviews.llvm.org/D55851) is planning to use getGuard() to extend the kind of loops it is able to fuse, e.g. rotated loop with non-constant upper bound, which would have a loop guard.
/// Example:
/// for (int i = lb; i < ub; i+=step)
/// <loop body>
/// --- pseudo LLVMIR ---
/// beforeloop:
/// guardcmp = (lb < ub)
/// if (guardcmp) goto preheader; else goto afterloop
/// preheader:
/// loop:
/// i1 = phi[{lb, preheader}, {i2, latch}]
/// <loop body>
/// i2 = i1 + step
/// latch:
/// cmp = (i2 < ub)
/// if (cmp) goto loop
/// exit:
/// afterloop:
///
/// getBounds
/// getInitialIVValue --> lb
/// getStepInst --> i2 = i1 + step
/// getStepValue --> step
/// getFinalIVValue --> ub
/// getCanonicalPredicate --> '<'
/// getDirection --> Increasing
/// getGuard --> if (guardcmp) goto loop; else goto afterloop
/// getInductionVariable --> i1
/// getAuxiliaryInductionVariable --> {i1}
/// isCanonical --> false
Committed on behalf of @Whitney (Whitney Tsang).
Reviewers: kbarton, hfinkel, dmgreen, Meinersbur, jdoerfert, syzaara, fhahn
Reviewed By: kbarton
Subscribers: tvvikram, bmahjour, etiotto, fhahn, jsji, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60565
llvm-svn: 361517
Diffstat (limited to 'clang/test/Frontend')
0 files changed, 0 insertions, 0 deletions