[LOOPINFO] Introduce the loop guard API.
authorWhitney Tsang <whitney.uwaterloo@gmail.com>
Thu, 25 Jul 2019 16:13:18 +0000 (16:13 +0000)
committerWhitney Tsang <whitney.uwaterloo@gmail.com>
Thu, 25 Jul 2019 16:13:18 +0000 (16:13 +0000)
commit8ee361ebe5ebada5c303b9aa93fecde9e4bec02a
tree04b7746ca07bd7d2511a96c9beebbc489394f6b4
parentdbc0a5df8d5f4fb826325b4f169acb5c26250c87
[LOOPINFO] Introduce the loop guard API.
Summary:
This is the first patch for the loop guard. We introduced
getLoopGuardBranch() and isGuarded().
This currently only works on simplified loop, as it requires a preheader
and a latch to identify the guard.
It will work on loops of the form:
/// GuardBB:
///   br cond1, Preheader, ExitSucc <== GuardBranch
/// Preheader:
///   br Header
/// Header:
///  ...
///   br Latch
/// Latch:
///   br cond2, Header, ExitBlock
/// ExitBlock:
///   br ExitSucc
/// ExitSucc:
Prior discussions leading upto the decision to introduce the loop guard
API: http://lists.llvm.org/pipermail/llvm-dev/2019-May/132607.html
Reviewer: reames, kbarton, hfinkel, jdoerfert, Meinersbur, dmgreen
Reviewed By: reames
Subscribers: wuzish, hiraditya, jsji, llvm-commits, bmahjour, etiotto
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D63885

llvm-svn: 367033
llvm/include/llvm/Analysis/LoopInfo.h
llvm/lib/Analysis/LoopInfo.cpp
llvm/unittests/Analysis/LoopInfoTest.cpp