[clang] [clang][dataflow] Check for backedges directly (instead of loop statements). (PR #68923)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 16 23:24:11 PDT 2023
================
@@ -53,19 +52,8 @@ static int blockIndexInPredecessor(const CFGBlock &Pred,
return BlockPos - Pred.succ_begin();
}
-static bool isLoopHead(const CFGBlock &B) {
- if (const auto *T = B.getTerminatorStmt())
- switch (T->getStmtClass()) {
- case Stmt::WhileStmtClass:
- case Stmt::DoStmtClass:
- case Stmt::ForStmtClass:
- case Stmt::CXXForRangeStmtClass:
- return true;
- default:
- return false;
- }
-
- return false;
+static bool isBackedgeNode(const CFGBlock &B) {
----------------
martinboehme wrote:
Yes, but
* It still requires work (not everyone has an IDE with great cross-linking, so this could be multiple clicks), and
*
* We're introducing a new term here ("backedge node"), and it's not clear without an explanation whether a) we intend for this to be a synonym for "has loop target" (but then why aren't we reusing that term -- is it because we think "backedge node" is clearer?), or b) `getLoopTarget() != nullptr` happens to be the right implementation today, but we think it might change in the future, so we're wrapping this check in a function?
https://github.com/llvm/llvm-project/pull/68923
More information about the cfe-commits
mailing list